Skip to content

Reference

This page holds documentation on properties and class methods for all scripts.

Public APIs

Public

Class to fetch public data from the Gemini REST API

Source code in gemini_api/endpoints/public.py
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
class Public:
    """
    Class to fetch public data from the Gemini REST API
    """

    def __init__(self, sandbox: bool = False) -> None:
        if sandbox:
            self.url = "https://api.sandbox.gemini.com/v1"
        else:
            self.url = "https://api.gemini.com/v1"

    def get_pairs(self) -> List[str]:
        """
        Retrieves an array of available trading pairs

        Returns:
            List of trading pairs, e.g. "BTCGBP"
        """

        data = requests.get(self.url + "/symbols")
        pairs = data.json()

        return pairs

    def get_pair_details(self, pair: str) -> Dict[str, Any]:
        """
        Retrieves the details for the trading pair

        Args:
            pair: Trading pair e.g."BTCGBP"
        Returns:
            Dictionary containing the details of the trading pair
        """
        data = requests.get(self.url + "/symbols/details/" + pair)
        details = data.json()
        return details

    def get_ticker(self, pair: str) -> Dict[str, Any]:
        """
        Retrieves information about recent trading activity for the
        trading pair, including bid size, last price and volume

        Args:
            pair: Trading pair e.g."BTCGBP"

        Returns:
            Dictionary containing the details of the pair's recent trades
        """

        data = requests.get(self.url + "/pubticker/" + pair)
        ticker = data.json()
        return ticker

    def get_ticker_prices(self, pair: str) -> Dict[str, Any]:
        """
        Retrieves information about recent trading activity for the
        trading pair, including open, close, high, low and prices
        from every hour.

        Args:
            pair: Trading pair e.g."BTCGBP"

        Returns:
            Dictionary containing the details of the pair's recent trades
        """
        v2_url = self.url.replace("v1", "v2")
        data = requests.get(v2_url + "/ticker/" + pair)
        ticker = data.json()
        return ticker

    def get_candles(self, pair: str, time_frame: str) -> List[List[float]]:
        """
        Retrieves time-intervaled data for the trading pair and time
        frame - accepts the following time frames: 1m, 5m, 15m, 30m,
        1hr, 6hr, 1day

        Args:
            pair: Trading pair e.g."BTCGBP"
            time_frame: Timeframe

        Returns:
            Nested lists of time-intervaled prices
        """
        v2_url = self.url.replace("v1", "v2")
        data = requests.get(v2_url + "/candles/" + pair + "/" + time_frame)
        candles = data.json()
        return candles

    def get_order_book(self, pair: str) -> Dict[str, List[Dict[str, str]]]:
        """
        Retrieves the current order book information, including bids
        and asks prices.

        The quantities and prices returned are returned as strings
        rather than numbers. The numbers returned are exact, not rounded,
        and it can be dangerous to treat them as floating point numbers.

        Args:
            pair: Trading pair e.g."BTCGBP"

        Returns:
            Dictionary with keys "bids" and "asks"
        """
        data = requests.get(self.url + "/book/" + pair)
        current_order_book = data.json()
        return current_order_book

    def get_trades_history(
        self, pair: str, since: str = None
    ) -> List[Dict[str, Any]]:
        """
        Retrieves executed trades data since the specified timestamp as
        a whole number in unix time format, up to seven calendar days of
        market data. Returns most recent data if timestamp is not specified

        Args:
            pair: Trading pair e.g."BTCGBP"
            since: Date in YYYYDDMM format

        Returns:
            List of dictionary objects containing the trade history
        """

        if not since:
            data = requests.get(self.url + "/trades/" + pair)
        else:
            self.timestamp = date_to_unix_ts(since)
            data = requests.get(
                self.url + "/trades/{}?since={}".format(pair, self.timestamp)
            )

        trades_history = data.json()
        return trades_history

    def get_current_auction(self, pair: str) -> Dict[str, Any]:
        """
        Retrieves current auction information, including auction price
        or indicative price

        Args:
            pair: Trading pair e.g."BTCGBP"

        Returns:
            Dictionary of current auction information
        """
        data = requests.get(self.url + "/auction/" + pair)
        current_auction = data.json()
        return current_auction

    def get_auction_history(
        self, pair: str, since: str = None
    ) -> List[Dict[str, Any]]:
        """
        Retrieves auction events data since the specified timestamp
        as a whole number in unix time format, up to seven calendar days
        of market data. Returns most recent data if timestamp is not
        specified.

        Args:
            pair: Trading pair e.g."BTCGBP"
            since: Date in YYYYDDMM format

        Returns:
            List of dictionary objects
        """

        if not since:
            data = requests.get(self.url + "/auction/" + pair + "/history")
        else:
            self.timestamp = date_to_unix_ts(since)
            data = requests.get(
                self.url
                + "/auction/history/{}?since={}".format(pair, self.timestamp)
            )

        auction_history = data.json()
        return auction_history

    def get_price_feed(self) -> List[Dict[str, str]]:
        """
        Retrieves list of dictionary containing price and percentage
        change in last 24h for each trading pair

        Returns:
            List of dictionaries containing the price and change in price
        """

        data = requests.get(self.url + "/pricefeed")
        price_feed = data.json()
        return price_feed

get_auction_history(pair, since=None)

Retrieves auction events data since the specified timestamp as a whole number in unix time format, up to seven calendar days of market data. Returns most recent data if timestamp is not specified.

Parameters:

Name Type Description Default
pair str

Trading pair e.g."BTCGBP"

required
since str

Date in YYYYDDMM format

None

Returns:

Type Description
List[Dict[str, Any]]

List of dictionary objects

Source code in gemini_api/endpoints/public.py
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
def get_auction_history(
    self, pair: str, since: str = None
) -> List[Dict[str, Any]]:
    """
    Retrieves auction events data since the specified timestamp
    as a whole number in unix time format, up to seven calendar days
    of market data. Returns most recent data if timestamp is not
    specified.

    Args:
        pair: Trading pair e.g."BTCGBP"
        since: Date in YYYYDDMM format

    Returns:
        List of dictionary objects
    """

    if not since:
        data = requests.get(self.url + "/auction/" + pair + "/history")
    else:
        self.timestamp = date_to_unix_ts(since)
        data = requests.get(
            self.url
            + "/auction/history/{}?since={}".format(pair, self.timestamp)
        )

    auction_history = data.json()
    return auction_history

get_candles(pair, time_frame)

Retrieves time-intervaled data for the trading pair and time frame - accepts the following time frames: 1m, 5m, 15m, 30m, 1hr, 6hr, 1day

Parameters:

Name Type Description Default
pair str

Trading pair e.g."BTCGBP"

required
time_frame str

Timeframe

required

Returns:

Type Description
List[List[float]]

Nested lists of time-intervaled prices

Source code in gemini_api/endpoints/public.py
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def get_candles(self, pair: str, time_frame: str) -> List[List[float]]:
    """
    Retrieves time-intervaled data for the trading pair and time
    frame - accepts the following time frames: 1m, 5m, 15m, 30m,
    1hr, 6hr, 1day

    Args:
        pair: Trading pair e.g."BTCGBP"
        time_frame: Timeframe

    Returns:
        Nested lists of time-intervaled prices
    """
    v2_url = self.url.replace("v1", "v2")
    data = requests.get(v2_url + "/candles/" + pair + "/" + time_frame)
    candles = data.json()
    return candles

get_current_auction(pair)

Retrieves current auction information, including auction price or indicative price

Parameters:

Name Type Description Default
pair str

Trading pair e.g."BTCGBP"

required

Returns:

Type Description
Dict[str, Any]

Dictionary of current auction information

Source code in gemini_api/endpoints/public.py
142
143
144
145
146
147
148
149
150
151
152
153
154
155
def get_current_auction(self, pair: str) -> Dict[str, Any]:
    """
    Retrieves current auction information, including auction price
    or indicative price

    Args:
        pair: Trading pair e.g."BTCGBP"

    Returns:
        Dictionary of current auction information
    """
    data = requests.get(self.url + "/auction/" + pair)
    current_auction = data.json()
    return current_auction

get_order_book(pair)

Retrieves the current order book information, including bids and asks prices.

The quantities and prices returned are returned as strings rather than numbers. The numbers returned are exact, not rounded, and it can be dangerous to treat them as floating point numbers.

Parameters:

Name Type Description Default
pair str

Trading pair e.g."BTCGBP"

required

Returns:

Type Description
Dict[str, List[Dict[str, str]]]

Dictionary with keys "bids" and "asks"

Source code in gemini_api/endpoints/public.py
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
def get_order_book(self, pair: str) -> Dict[str, List[Dict[str, str]]]:
    """
    Retrieves the current order book information, including bids
    and asks prices.

    The quantities and prices returned are returned as strings
    rather than numbers. The numbers returned are exact, not rounded,
    and it can be dangerous to treat them as floating point numbers.

    Args:
        pair: Trading pair e.g."BTCGBP"

    Returns:
        Dictionary with keys "bids" and "asks"
    """
    data = requests.get(self.url + "/book/" + pair)
    current_order_book = data.json()
    return current_order_book

get_pair_details(pair)

Retrieves the details for the trading pair

Parameters:

Name Type Description Default
pair str

Trading pair e.g."BTCGBP"

required

Returns:

Type Description
Dict[str, Any]

Dictionary containing the details of the trading pair

Source code in gemini_api/endpoints/public.py
32
33
34
35
36
37
38
39
40
41
42
43
def get_pair_details(self, pair: str) -> Dict[str, Any]:
    """
    Retrieves the details for the trading pair

    Args:
        pair: Trading pair e.g."BTCGBP"
    Returns:
        Dictionary containing the details of the trading pair
    """
    data = requests.get(self.url + "/symbols/details/" + pair)
    details = data.json()
    return details

get_pairs()

Retrieves an array of available trading pairs

Returns:

Type Description
List[str]

List of trading pairs, e.g. "BTCGBP"

Source code in gemini_api/endpoints/public.py
19
20
21
22
23
24
25
26
27
28
29
30
def get_pairs(self) -> List[str]:
    """
    Retrieves an array of available trading pairs

    Returns:
        List of trading pairs, e.g. "BTCGBP"
    """

    data = requests.get(self.url + "/symbols")
    pairs = data.json()

    return pairs

get_price_feed()

Retrieves list of dictionary containing price and percentage change in last 24h for each trading pair

Returns:

Type Description
List[Dict[str, str]]

List of dictionaries containing the price and change in price

Source code in gemini_api/endpoints/public.py
186
187
188
189
190
191
192
193
194
195
196
197
def get_price_feed(self) -> List[Dict[str, str]]:
    """
    Retrieves list of dictionary containing price and percentage
    change in last 24h for each trading pair

    Returns:
        List of dictionaries containing the price and change in price
    """

    data = requests.get(self.url + "/pricefeed")
    price_feed = data.json()
    return price_feed

get_ticker(pair)

Retrieves information about recent trading activity for the trading pair, including bid size, last price and volume

Parameters:

Name Type Description Default
pair str

Trading pair e.g."BTCGBP"

required

Returns:

Type Description
Dict[str, Any]

Dictionary containing the details of the pair's recent trades

Source code in gemini_api/endpoints/public.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def get_ticker(self, pair: str) -> Dict[str, Any]:
    """
    Retrieves information about recent trading activity for the
    trading pair, including bid size, last price and volume

    Args:
        pair: Trading pair e.g."BTCGBP"

    Returns:
        Dictionary containing the details of the pair's recent trades
    """

    data = requests.get(self.url + "/pubticker/" + pair)
    ticker = data.json()
    return ticker

get_ticker_prices(pair)

Retrieves information about recent trading activity for the trading pair, including open, close, high, low and prices from every hour.

Parameters:

Name Type Description Default
pair str

Trading pair e.g."BTCGBP"

required

Returns:

Type Description
Dict[str, Any]

Dictionary containing the details of the pair's recent trades

Source code in gemini_api/endpoints/public.py
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
def get_ticker_prices(self, pair: str) -> Dict[str, Any]:
    """
    Retrieves information about recent trading activity for the
    trading pair, including open, close, high, low and prices
    from every hour.

    Args:
        pair: Trading pair e.g."BTCGBP"

    Returns:
        Dictionary containing the details of the pair's recent trades
    """
    v2_url = self.url.replace("v1", "v2")
    data = requests.get(v2_url + "/ticker/" + pair)
    ticker = data.json()
    return ticker

get_trades_history(pair, since=None)

Retrieves executed trades data since the specified timestamp as a whole number in unix time format, up to seven calendar days of market data. Returns most recent data if timestamp is not specified

Parameters:

Name Type Description Default
pair str

Trading pair e.g."BTCGBP"

required
since str

Date in YYYYDDMM format

None

Returns:

Type Description
List[Dict[str, Any]]

List of dictionary objects containing the trade history

Source code in gemini_api/endpoints/public.py
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
def get_trades_history(
    self, pair: str, since: str = None
) -> List[Dict[str, Any]]:
    """
    Retrieves executed trades data since the specified timestamp as
    a whole number in unix time format, up to seven calendar days of
    market data. Returns most recent data if timestamp is not specified

    Args:
        pair: Trading pair e.g."BTCGBP"
        since: Date in YYYYDDMM format

    Returns:
        List of dictionary objects containing the trade history
    """

    if not since:
        data = requests.get(self.url + "/trades/" + pair)
    else:
        self.timestamp = date_to_unix_ts(since)
        data = requests.get(
            self.url + "/trades/{}?since={}".format(pair, self.timestamp)
        )

    trades_history = data.json()
    return trades_history

Authentication

Authentication

Bases: object

Class to manage authentication.

Class provides methods to authenticate and make requests to Gemini's APIs

Attributes:

Name Type Description
_public_key str

a public key for authentication

_private_key str

a private_key for authentication

_url

base URL for Gemini API

Methods

make_request: makes a request to an endpoint URL

Source code in gemini_api/authentication.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
class Authentication(object):
    """
    Class to manage authentication.

    Class provides methods to authenticate and make requests to
    Gemini's APIs

    Attributes:
        _public_key: a public key for authentication
        _private_key: a private_key for authentication
        _url: base URL for Gemini API

    Methods:
        make_request: makes a request to an endpoint URL
    """

    __slots__ = ["_public_key", "_private_key", "_url"]

    def __init__(
        self, public_key: str, private_key: str, sandbox: bool = False
    ) -> None:
        """
        Initialise authentication

        Args:
            sandbox: flag for connecting to Sandbox environment
        """

        self._public_key: str = public_key
        self._private_key: str = private_key

        if sandbox:
            self._url = GEMINI_SANDBOX_BASE_URL
        else:
            self._url = GEMINI_REQUEST_BASE_URL

    def make_request(
        self, endpoint: str, payload: Dict[Any, Any] = None
    ) -> Union[Dict[Any, Any], Any]:
        """
        Makes a request to an endpoint in the API

        Args:
            endpoint: String to add to base URL
            payload: Data to pass into encoded payload

        Returns:
            Dictionary containing response data
        """

        if not payload:
            payload = {}

        request_url = self._url + endpoint

        payload["request"] = endpoint
        payload["nonce"] = str(
            int(time.mktime(datetime.now().timetuple()) * 1000)
        )

        encoded_payload = json.dumps(payload).encode("utf-8")
        b64 = base64.b64encode(encoded_payload)
        signature = hmac.new(
            self._private_key.encode("utf-8"), b64, hashlib.sha384
        ).hexdigest()

        request_headers = {
            "Content-Type": "text/plain",
            "Content-Length": "0",
            "X-GEMINI-APIKEY": self._public_key,
            "X-GEMINI-PAYLOAD": b64,
            "X-GEMINI-SIGNATURE": signature,
            "Cache-Control": "no-cache",
        }

        request = requests.post(
            request_url, data=None, headers=request_headers
        )
        data = request.json()
        return data

__init__(public_key, private_key, sandbox=False)

Initialise authentication

Parameters:

Name Type Description Default
sandbox bool

flag for connecting to Sandbox environment

False
Source code in gemini_api/authentication.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
def __init__(
    self, public_key: str, private_key: str, sandbox: bool = False
) -> None:
    """
    Initialise authentication

    Args:
        sandbox: flag for connecting to Sandbox environment
    """

    self._public_key: str = public_key
    self._private_key: str = private_key

    if sandbox:
        self._url = GEMINI_SANDBOX_BASE_URL
    else:
        self._url = GEMINI_REQUEST_BASE_URL

make_request(endpoint, payload=None)

Makes a request to an endpoint in the API

Parameters:

Name Type Description Default
endpoint str

String to add to base URL

required
payload Dict[Any, Any]

Data to pass into encoded payload

None

Returns:

Type Description
Union[Dict[Any, Any], Any]

Dictionary containing response data

Source code in gemini_api/authentication.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def make_request(
    self, endpoint: str, payload: Dict[Any, Any] = None
) -> Union[Dict[Any, Any], Any]:
    """
    Makes a request to an endpoint in the API

    Args:
        endpoint: String to add to base URL
        payload: Data to pass into encoded payload

    Returns:
        Dictionary containing response data
    """

    if not payload:
        payload = {}

    request_url = self._url + endpoint

    payload["request"] = endpoint
    payload["nonce"] = str(
        int(time.mktime(datetime.now().timetuple()) * 1000)
    )

    encoded_payload = json.dumps(payload).encode("utf-8")
    b64 = base64.b64encode(encoded_payload)
    signature = hmac.new(
        self._private_key.encode("utf-8"), b64, hashlib.sha384
    ).hexdigest()

    request_headers = {
        "Content-Type": "text/plain",
        "Content-Length": "0",
        "X-GEMINI-APIKEY": self._public_key,
        "X-GEMINI-PAYLOAD": b64,
        "X-GEMINI-SIGNATURE": signature,
        "Cache-Control": "no-cache",
    }

    request = requests.post(
        request_url, data=None, headers=request_headers
    )
    data = request.json()
    return data

Order Placement/Status APIs

Order

Class that manages order book placement to create new orders, wrap orders and cancel orders.

Source code in gemini_api/endpoints/order.py
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
class Order:
    """
    Class that manages order book placement to create new orders,
    wrap orders and cancel orders.
    """

    __slots__ = [
        "_order_id",
        "_id",
        "_client_order_id",
        "_symbol",
        "_exchange",
        "_avg_execution_price",
        "_side",
        "_order_type",
        "_timestamp",
        "_timestampms",
        "_trades",
        "_is_live",
        "_is_cancelled",
        "_reason",
        "_is_hidden",
        "_was_forced",
        "_executed_amount",
        "_remaining_amount",
        "_options",
        "_price",
        "_amount",
        "_original_amount",
        "_remaining_amount",
        "_pair",
        "_price_currency",
        "_quantity",
        "_quantity_currency",
        "_total_spend",
        "_total_spend_currency",
        "_fee",
        "_fee_currency",
        "_fee_amount",
        "_deposit_fee",
        "_deposit_fee_currency",
        "_trade_id",
        "_aggressor",
        "_is_auction_fill",
        "_is_clearing_fill",
        "_break_type",
        "_reason",
        "_result",
        "_message",
    ]

    def __init__(
        self, auth: Authentication, order_data: Dict[Any, Any]
    ) -> None:
        """
        Initialise Order class
        """
        if "order_id" in order_data:
            if isinstance(order_data["order_id"], str):
                self._order_id: Union[str, Dict[int, bool]] = order_data[
                    "order_id"
                ]
            else:
                if isinstance(order_data["order_id"], dict):
                    self._order_id = list(order_data["order_id"].keys())[0]
                    self._is_cancelled: bool = list(
                        order_data["order_id"].values()
                    )[0]
        if "orderId" in order_data:
            self._order_id = order_data["orderId"]
        if "id" in order_data:
            self._id: str = order_data["id"]
        if "client_order_id" in order_data:
            self._client_order_id: str = order_data["client_order_id"]
        if "symbol" in order_data:
            self._symbol: str = order_data["symbol"]
        if "exchange" in order_data:
            self._exchange: str = order_data["exchange"]
        if "avg_execution_price" in order_data:
            self._avg_execution_price: str = order_data["avg_execution_price"]
        if "side" in order_data:
            self._side: str = order_data["side"]
        if "type" in order_data:
            self._order_type: str = order_data["type"]
        if "timestamp" in order_data:
            self._timestamp: str = order_data["timestamp"]
        if "timestampms" in order_data:
            self._timestampms: int = order_data["timestampms"]
        if "trades" in order_data:
            self._trades: List[Dict[str, Union[str, Any]]] = order_data[
                "trades"
            ]
        if "is_live" in order_data:
            self._is_live: bool = order_data["is_live"]
        if "is_cancelled" in order_data:
            self._is_cancelled = order_data["is_cancelled"]
        if "is_hidden" in order_data:
            self._is_hidden: bool = order_data["is_hidden"]
        if "was_forced" in order_data:
            self._was_forced: bool = order_data["was_forced"]
        if "executed_amount" in order_data:
            self._executed_amount: float = order_data["executed_amount"]
        if "remaining_amount" in order_data:
            self._remaining_amount: str = order_data["remaining_amount"]
        if "options" in order_data:
            self._options: List[str] = order_data["options"]
        if "price" in order_data:
            self._price: str = order_data["price"]
        if "original_amount" in order_data:
            self._original_amount: str = order_data["original_amount"]
        if "pair" in order_data:
            self._pair: str = order_data["pair"]
        if "priceCurrency" in order_data:
            self._price_currency: str = order_data["priceCurrency"]
        if "quantity" in order_data:
            self._quantity: str = order_data["quantity"]
        if "quantityCurrency" in order_data:
            self._quantity_currency: str = order_data["quantityCurrency"]
        if "totalSpend" in order_data:
            self._total_spend: str = order_data["totalSpend"]
        if "totalSpendCurrency" in order_data:
            self._total_spend_currency: str = order_data["totalSpendCurrency"]
        if "fee" in order_data:
            self._fee: str = order_data["fee"]
        if "feeCurrency" in order_data:
            self._fee_currency: str = order_data["feeCurrency"]
        if "fee_currency" in order_data:
            self._fee_currency = order_data["fee_currency"]
        if "depositFee" in order_data:
            self._deposit_fee: str = order_data["depositFee"]
        if "depositFeeCurrency" in order_data:
            self._deposit_fee_currency: str = order_data["depositFeeCurrency"]
        if "amount" in order_data:
            self._amount: float = order_data["amount"]
        if "aggressor" in order_data:
            self._aggressor: bool = order_data["aggressor"]
        if "fee_amount" in order_data:
            self._fee_amount: str = order_data["fee_amount"]
        if "tid" in order_data:
            self._trade_id: int = order_data["tid"]
        if "is_auction_fill" in order_data:
            self._is_auction_fill: bool = order_data["is_auction_fill"]
        if "is_clearing_fill" in order_data:
            self._is_clearing_fill: bool = order_data["is_clearing_fill"]
        if "break" in order_data:
            self._break_type: str = order_data["break"]
        if "result" in order_data:
            self._result: str = order_data["result"]
        if "reason" in order_data:
            self._reason: str = order_data["reason"]
        if "message" in order_data:
            self._message: str = order_data["message"]

    @property
    def order_id(self) -> Union[str, Dict[int, bool]]:
        """
        Property for the order ID

        Returns:
            Order ID
        """
        return self._order_id

    @property
    def id(self) -> str:
        """
        Property for the ID

        Returns:
            ID
        """
        return self._id

    @property
    def client_order_id(self) -> str:
        """
        Property for the Client Order ID

        Returns:
            Client Order ID
        """
        return self._client_order_id

    @property
    def symbol(self) -> str:
        """
        Property for the symbol of the order

        Returns:
            Symbol
        """
        return self._symbol

    @property
    def exchange(self) -> str:
        """
        Property for the exchange (always "gemini")

        Returns:
            exchange
        """
        return self._exchange

    @property
    def avg_execution_price(self) -> str:
        """
        Property for the average price at which this order as been
        executed so far. 0 if the order has not been executed at all

        Returns:
            avg_execution_price
        """
        return self._avg_execution_price

    @property
    def side(self) -> str:
        """
        Property for the side (either "buy" or "sell")

        Returns:
            Side
        """
        return self._side

    @property
    def order_type(self) -> str:
        """
        Property for the description of the type:
        exchange limit, auction-only exchange limit, market buy,
        market sell, indication-of-interest

        Returns:
            type
        """
        return self._order_type

    @property
    def timestamp(self) -> str:
        """
        Property for the  timestamp the order was submitted. Note that
        for compatibility reasons, this is returned as a string.
        Recommend using the timestampms field instead

        Returns:
            The number of seconds since 1970-01-01 UTC (unix epoch)
        """
        return self._timestamp

    @property
    def timestampms(self) -> int:
        """
        Property for the timestamp the order was submitted in milliseconds

        Returns:
            The number of milliseconds since 1970-01-01 UTC
        """
        return self._timestampms

    @property
    def trades(self) -> List[Dict[str, Any]]:
        """
        Property for the trades containing trade details

        Returns:
            List of trade dictionary objects
        """
        return self._trades

    @property
    def is_live(self) -> bool:
        """
        Property for the active status of an order

        Returns:
            True if the order is on the book (has remaining quantity
            and has not been canceled), false otherwise
        """
        return self._is_live

    @property
    def is_cancelled(self) -> bool:
        """
        Property for the cancelled status of an order

        Returns:
            True if the order has been canceled
        """
        return self._is_cancelled

    @property
    def is_hidden(self) -> bool:
        """
        Property for the hidden status of an order

        Returns:
            Will always return false unless the order was placed with
            the indication-of-interest execution option.
        """
        return self._is_hidden

    @property
    def was_forced(self) -> bool:
        """
        Property for the forced status of an order (always False)

        Returns:
            False.
        """
        return self._was_forced

    @property
    def executed_amount(self) -> float:
        """
        Property for the amount of the order that has been filled

        Returns:
            Executed amount
        """
        return self._executed_amount

    @property
    def remaining_amount(self) -> str:
        """
        Property for the amount of the order that has not been filled

        Returns:
            Remaining amount
        """
        return self._remaining_amount

    @property
    def options(self) -> List[str]:
        """
        Property for the options containing at most one supported
        order execution option

        Returns:
            Options
        """
        return self._options

    @property
    def price(self) -> str:
        """
        Property for the price the order was issued at

        Returns:
            Price
        """
        return self._price

    @property
    def original_amount(self) -> str:
        """
        Property for the originally submitted amount of the order.

        Returns:
            Original amount
        """
        return self._original_amount

    @property
    def price_currency(self) -> str:
        """
        Property for the price_currency

        Returns:
            price_currency
        """
        return self._price_currency

    @property
    def quantity(self) -> str:
        """
        Property for the quantity

        Returns:
            quantity
        """
        return self._quantity

    @property
    def quantity_currency(self) -> str:
        """
        Property for the currency quantity label for the quantity field
        in wrap orders - matches 'CCY1' in the symbol

        Returns:
            Currency quantity label
        """
        return self._quantity_currency

    @property
    def total_spend(self) -> str:
        """
        Property for the total quantity to spend for the order - will be
        the sum inclusive of all fees and amount to be traded

        Returns:
            Total spend
        """
        return self._total_spend

    @property
    def total_spend_currency(self) -> str:
        """
        Property for the currency of the total spend to be spent on the
        order

        Returns:
            Total spend currency
        """
        return self._total_spend_currency

    @property
    def fee(self) -> str:
        """
        Property for the fee amount charged

        Returns:
            Fee
        """
        return self._fee

    @property
    def fee_currency(self) -> str:
        """
        Property for the currency that the fee was paid in

        Returns:
            Currency
        """
        return self._fee_currency

    @property
    def deposit_fee(self) -> str:
        """
        Property for the deposit fee quantity - will be applied if a
        debit card is used for the order. Will return 0 if there is no
        deposit fee

        Returns:
            depositFee
        """
        return self._deposit_fee

    @property
    def deposit_fee_currency(self) -> str:
        """
        Property for the currency in which the deposit fee is taken

        Returns:
            Currency
        """
        return self._deposit_fee_currency

    @property
    def aggressor(self) -> bool:
        """
        Property for whether this order was the taker in the trade

        Returns:
            True if taker in the trade, False otherwise
        """
        return self._aggressor

    @property
    def fee_amount(self) -> str:
        """
        Property for the amount charged

        Returns:
            Fee
        """
        return self._fee_amount

    @property
    def trade_id(self) -> int:
        """
        Property for the unique trade id

        Returns:
            Trade id
        """
        return self._trade_id

    @property
    def is_auction_fill(self) -> bool:
        """
        Property for the auction status

        Returns:
            True if the trade was filled at an auction, False otherwise
        """
        return self._is_auction_fill

    @property
    def is_clearing_fill(self) -> bool:
        """
        Property for the clearing status

        Returns:
            True if the trade was a clearing trade at and not on an
            on-exchange trade, False otherwise
        """
        return self._is_clearing_fill

    @property
    def break_type(self) -> str:
        """
        Property for the break if the trade is broken

        Returns:
            Break
        """
        return self._break_type

    @property
    def heartbeat(self) -> str:
        """
        Property for the heartbeat if set as an option in api settings
        which always returns "ok"

        Returns:
            Result
        """
        return self._result

    @property
    def result(self) -> str:
        """
        Property for the result upon errors or the state of a request

        Returns:
            Result
        """
        return self._result

    @property
    def reason(self) -> str:
        """
        Property for the reason of errors

        Returns:
            Short error description
        """
        return self._reason

    @property
    def message(self) -> str:
        """
        Property for the error message

        Returns:
            Error message description
        """
        return self._message

    @classmethod
    def new_order(
        cls,
        auth: Authentication,
        symbol: str,
        amount: str,
        price: str,
        side: str,
        options: List[str] = [],
        stop_limit: bool = False,
        stop_price: Optional[str] = None,
        client_order_id: str = None,
    ) -> Order:
        """
        Method to create a new limit or stop-limit order

        Args:
            auth: Gemini authentication object
            symbol: Trading pair
            amount: Quoted decimal amount to purchase
            price: Quoted decimal amount to spend per unit
            options: Option of order execution, defaults to limit order
            stop_price: The price to trigger a stop-limit order
            stop_limit: True if stop_price is provided
            client_order_id: Client-specified order if

        Returns:
            Order object
        """
        path = "/v1/order/new"

        data: Union[Dict[Any, Any], Any] = {
            "symbol": symbol,
            "amount": amount,
            "price": price,
            "side": side,
            "options": options,
            "type": "exchange limit",
        }
        if stop_limit:
            data["type"] = "exchange stop limit"
            data["stop_price"] = stop_price

        if client_order_id is not None:
            data["client_order_id"] = client_order_id

        res = auth.make_request(endpoint=path, payload=data)
        return Order(auth=auth, order_data=res)

    @classmethod
    def cancel_order(
        cls,
        auth: Authentication,
        order_id: str,
    ) -> Order:
        """
        Method to cancel an order

        Args:
            auth: Gemini authentication object
            order_id: The order id

        Returns:
            Order object
        """
        path = "/v1/order/cancel"

        data = {"order_id": order_id}
        res = auth.make_request(endpoint=path, payload=data)
        return Order(auth=auth, order_data=res)

    @classmethod
    def wrap_order(
        cls,
        auth: Authentication,
        amount: str,
        side: str,
        symbol: str,
        client_order_id: str = None,
    ) -> Order:
        """
        Method to wrap or unwrap Gemini isued assets

        Args:
            auth: Gemini authentication object
            amount: Amount of currency to purchase
            side: Either "buy" or "sell"
            symbol: Trading pair
            client_order_id: Client-specified order id

        Returns:
            Order object
        """
        path = f"/v1/order/{symbol}"

        data = {
            "amount": amount,
            "side": side,
            "client_order_id": client_order_id,
        }

        if client_order_id is not None:
            data["client_order_id"] = client_order_id

        res = auth.make_request(endpoint=path, payload=data)
        return Order(auth=auth, order_data=res)

    @classmethod
    def cancel_session_orders(
        cls,
        auth: Authentication,
    ) -> List[Order]:

        """
        Method to cancel all session orders

        Args:
            auth: Gemini authentication object

        Returns:
            Order object
        """
        path = "/v1/order/cancel/session"

        res = auth.make_request(endpoint=path)

        all_cancelled_session_orders = []
        orders: Dict[str, Any] = {}
        orders["order_id"] = {}

        for k, v in res["details"].items():
            if k == "cancelledOrders":
                for id in v:
                    orders["order_id"][id] = True

            if k == "cancelRejects":
                for id in v:
                    orders["order_id"][id] = False

        for k, v in orders["order_id"].items():
            new_dict: Dict[str, Any] = {}
            new_dict["order_id"] = {}
            new_dict["order_id"][k] = v
            obj = Order(auth=auth, order_data=new_dict)
            all_cancelled_session_orders.append(obj)

        return all_cancelled_session_orders

    @classmethod
    def cancel_active_orders(
        cls,
        auth: Authentication,
    ) -> List[Order]:

        """
        Method to cancel all active orders

        Args:
            auth: Gemini authentication object

        Returns:
            Order object
        """
        path = "/v1/order/cancel/all"

        res = auth.make_request(endpoint=path)

        all_cancelled_active_orders = []
        orders: Dict[str, Any] = {}
        orders["order_id"] = {}

        for k, v in res["details"].items():
            if k == "cancelledOrders":
                for id in v:
                    orders["order_id"][id] = True

            if k == "cancelRejects":
                for id in v:
                    orders["order_id"][id] = False

        for k, v in orders["order_id"].items():
            new_dict: Dict[str, Any] = {}
            new_dict["order_id"] = {}
            new_dict["order_id"][k] = v
            obj = Order(auth=auth, order_data=new_dict)
            all_cancelled_active_orders.append(obj)

        return all_cancelled_active_orders

    @classmethod
    def order_status(
        cls,
        auth: Authentication,
        order_id: str,
        include_trades: bool,
        client_order_id: str = None,
    ) -> Order:

        """
        Method to get order status

        The order id to get information on - cannot be
        used in combination with client_order_id

        Args:
            auth: Gemini authentication object
            order_id: The order id
            include_trades: Include trade details of all fills from the order
            client_order_id: Client-specified order

        Returns:
            Order object
        """
        path = "/v1/order/status"

        data = {
            "order_id": order_id,
            "include_trades": include_trades,
        }

        if client_order_id is not None:
            data["client_order_id"] = client_order_id

        res = auth.make_request(endpoint=path, payload=data)
        return Order(auth=auth, order_data=res)

    @classmethod
    def get_active_orders(cls, auth: Authentication) -> List[Order]:

        """
        Method to get active orders

        Args:
            auth: Gemini authentication object

        Returns:
            List of Order objects
        """
        path = "/v1/orders"

        res = auth.make_request(endpoint=path)

        all_active_orders = []

        for i in range(len(res)):
            order = Order(auth=auth, order_data=res[i])
            all_active_orders.append(order)

        return all_active_orders

    @classmethod
    def get_past_trades(
        cls,
        auth: Authentication,
        symbol: str,
        since: str = None,
        limit_trades: int = None,
    ) -> List[Order]:

        """
        Method to get past trades

        Args:
            auth: Gemini authentication object
            symbol: Trading pair
            since: Date in YYYYMMDD format
            limit_trades: Maximum number of trades to return, min 50 max 500

        Returns:
            List of Order objects
        """
        path = "/v1/mytrades"

        data: Dict[str, Any] = {
            "symbol": symbol,
        }

        if since is not None:
            data["timestamp"] = date_to_unix_ts(since)
        if limit_trades is not None:
            data["limit_trades"] = limit_trades

        res = auth.make_request(endpoint=path, payload=data)

        all_past_trades = []

        for i in range(len(res)):
            past_trade = Order(auth=auth, order_data=res[i])
            all_past_trades.append(past_trade)

        return all_past_trades

    @classmethod
    def revive_heartbeat(
        cls,
        auth: Authentication,
    ) -> Order:

        """
        Method to revive the heartbeat

        Args:
            auth: Gemini authentication object

        Returns:
            Order object
        """
        path = "/v1/heartbeat"

        res = auth.make_request(endpoint=path)

        return Order(auth=auth, order_data=res)

__init__(auth, order_data)

Initialise Order class

Source code in gemini_api/endpoints/order.py
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
def __init__(
    self, auth: Authentication, order_data: Dict[Any, Any]
) -> None:
    """
    Initialise Order class
    """
    if "order_id" in order_data:
        if isinstance(order_data["order_id"], str):
            self._order_id: Union[str, Dict[int, bool]] = order_data[
                "order_id"
            ]
        else:
            if isinstance(order_data["order_id"], dict):
                self._order_id = list(order_data["order_id"].keys())[0]
                self._is_cancelled: bool = list(
                    order_data["order_id"].values()
                )[0]
    if "orderId" in order_data:
        self._order_id = order_data["orderId"]
    if "id" in order_data:
        self._id: str = order_data["id"]
    if "client_order_id" in order_data:
        self._client_order_id: str = order_data["client_order_id"]
    if "symbol" in order_data:
        self._symbol: str = order_data["symbol"]
    if "exchange" in order_data:
        self._exchange: str = order_data["exchange"]
    if "avg_execution_price" in order_data:
        self._avg_execution_price: str = order_data["avg_execution_price"]
    if "side" in order_data:
        self._side: str = order_data["side"]
    if "type" in order_data:
        self._order_type: str = order_data["type"]
    if "timestamp" in order_data:
        self._timestamp: str = order_data["timestamp"]
    if "timestampms" in order_data:
        self._timestampms: int = order_data["timestampms"]
    if "trades" in order_data:
        self._trades: List[Dict[str, Union[str, Any]]] = order_data[
            "trades"
        ]
    if "is_live" in order_data:
        self._is_live: bool = order_data["is_live"]
    if "is_cancelled" in order_data:
        self._is_cancelled = order_data["is_cancelled"]
    if "is_hidden" in order_data:
        self._is_hidden: bool = order_data["is_hidden"]
    if "was_forced" in order_data:
        self._was_forced: bool = order_data["was_forced"]
    if "executed_amount" in order_data:
        self._executed_amount: float = order_data["executed_amount"]
    if "remaining_amount" in order_data:
        self._remaining_amount: str = order_data["remaining_amount"]
    if "options" in order_data:
        self._options: List[str] = order_data["options"]
    if "price" in order_data:
        self._price: str = order_data["price"]
    if "original_amount" in order_data:
        self._original_amount: str = order_data["original_amount"]
    if "pair" in order_data:
        self._pair: str = order_data["pair"]
    if "priceCurrency" in order_data:
        self._price_currency: str = order_data["priceCurrency"]
    if "quantity" in order_data:
        self._quantity: str = order_data["quantity"]
    if "quantityCurrency" in order_data:
        self._quantity_currency: str = order_data["quantityCurrency"]
    if "totalSpend" in order_data:
        self._total_spend: str = order_data["totalSpend"]
    if "totalSpendCurrency" in order_data:
        self._total_spend_currency: str = order_data["totalSpendCurrency"]
    if "fee" in order_data:
        self._fee: str = order_data["fee"]
    if "feeCurrency" in order_data:
        self._fee_currency: str = order_data["feeCurrency"]
    if "fee_currency" in order_data:
        self._fee_currency = order_data["fee_currency"]
    if "depositFee" in order_data:
        self._deposit_fee: str = order_data["depositFee"]
    if "depositFeeCurrency" in order_data:
        self._deposit_fee_currency: str = order_data["depositFeeCurrency"]
    if "amount" in order_data:
        self._amount: float = order_data["amount"]
    if "aggressor" in order_data:
        self._aggressor: bool = order_data["aggressor"]
    if "fee_amount" in order_data:
        self._fee_amount: str = order_data["fee_amount"]
    if "tid" in order_data:
        self._trade_id: int = order_data["tid"]
    if "is_auction_fill" in order_data:
        self._is_auction_fill: bool = order_data["is_auction_fill"]
    if "is_clearing_fill" in order_data:
        self._is_clearing_fill: bool = order_data["is_clearing_fill"]
    if "break" in order_data:
        self._break_type: str = order_data["break"]
    if "result" in order_data:
        self._result: str = order_data["result"]
    if "reason" in order_data:
        self._reason: str = order_data["reason"]
    if "message" in order_data:
        self._message: str = order_data["message"]

aggressor() property

Property for whether this order was the taker in the trade

Returns:

Type Description
bool

True if taker in the trade, False otherwise

Source code in gemini_api/endpoints/order.py
465
466
467
468
469
470
471
472
473
@property
def aggressor(self) -> bool:
    """
    Property for whether this order was the taker in the trade

    Returns:
        True if taker in the trade, False otherwise
    """
    return self._aggressor

avg_execution_price() property

Property for the average price at which this order as been executed so far. 0 if the order has not been executed at all

Returns:

Type Description
str

avg_execution_price

Source code in gemini_api/endpoints/order.py
212
213
214
215
216
217
218
219
220
221
@property
def avg_execution_price(self) -> str:
    """
    Property for the average price at which this order as been
    executed so far. 0 if the order has not been executed at all

    Returns:
        avg_execution_price
    """
    return self._avg_execution_price

break_type() property

Property for the break if the trade is broken

Returns:

Type Description
str

Break

Source code in gemini_api/endpoints/order.py
516
517
518
519
520
521
522
523
524
@property
def break_type(self) -> str:
    """
    Property for the break if the trade is broken

    Returns:
        Break
    """
    return self._break_type

cancel_active_orders(auth) classmethod

Method to cancel all active orders

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required

Returns:

Type Description
List[Order]

Order object

Source code in gemini_api/endpoints/order.py
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
@classmethod
def cancel_active_orders(
    cls,
    auth: Authentication,
) -> List[Order]:

    """
    Method to cancel all active orders

    Args:
        auth: Gemini authentication object

    Returns:
        Order object
    """
    path = "/v1/order/cancel/all"

    res = auth.make_request(endpoint=path)

    all_cancelled_active_orders = []
    orders: Dict[str, Any] = {}
    orders["order_id"] = {}

    for k, v in res["details"].items():
        if k == "cancelledOrders":
            for id in v:
                orders["order_id"][id] = True

        if k == "cancelRejects":
            for id in v:
                orders["order_id"][id] = False

    for k, v in orders["order_id"].items():
        new_dict: Dict[str, Any] = {}
        new_dict["order_id"] = {}
        new_dict["order_id"][k] = v
        obj = Order(auth=auth, order_data=new_dict)
        all_cancelled_active_orders.append(obj)

    return all_cancelled_active_orders

cancel_order(auth, order_id) classmethod

Method to cancel an order

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
order_id str

The order id

required

Returns:

Type Description
Order

Order object

Source code in gemini_api/endpoints/order.py
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
@classmethod
def cancel_order(
    cls,
    auth: Authentication,
    order_id: str,
) -> Order:
    """
    Method to cancel an order

    Args:
        auth: Gemini authentication object
        order_id: The order id

    Returns:
        Order object
    """
    path = "/v1/order/cancel"

    data = {"order_id": order_id}
    res = auth.make_request(endpoint=path, payload=data)
    return Order(auth=auth, order_data=res)

cancel_session_orders(auth) classmethod

Method to cancel all session orders

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required

Returns:

Type Description
List[Order]

Order object

Source code in gemini_api/endpoints/order.py
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
@classmethod
def cancel_session_orders(
    cls,
    auth: Authentication,
) -> List[Order]:

    """
    Method to cancel all session orders

    Args:
        auth: Gemini authentication object

    Returns:
        Order object
    """
    path = "/v1/order/cancel/session"

    res = auth.make_request(endpoint=path)

    all_cancelled_session_orders = []
    orders: Dict[str, Any] = {}
    orders["order_id"] = {}

    for k, v in res["details"].items():
        if k == "cancelledOrders":
            for id in v:
                orders["order_id"][id] = True

        if k == "cancelRejects":
            for id in v:
                orders["order_id"][id] = False

    for k, v in orders["order_id"].items():
        new_dict: Dict[str, Any] = {}
        new_dict["order_id"] = {}
        new_dict["order_id"][k] = v
        obj = Order(auth=auth, order_data=new_dict)
        all_cancelled_session_orders.append(obj)

    return all_cancelled_session_orders

client_order_id() property

Property for the Client Order ID

Returns:

Type Description
str

Client Order ID

Source code in gemini_api/endpoints/order.py
182
183
184
185
186
187
188
189
190
@property
def client_order_id(self) -> str:
    """
    Property for the Client Order ID

    Returns:
        Client Order ID
    """
    return self._client_order_id

deposit_fee() property

Property for the deposit fee quantity - will be applied if a debit card is used for the order. Will return 0 if there is no deposit fee

Returns:

Type Description
str

depositFee

Source code in gemini_api/endpoints/order.py
443
444
445
446
447
448
449
450
451
452
453
@property
def deposit_fee(self) -> str:
    """
    Property for the deposit fee quantity - will be applied if a
    debit card is used for the order. Will return 0 if there is no
    deposit fee

    Returns:
        depositFee
    """
    return self._deposit_fee

deposit_fee_currency() property

Property for the currency in which the deposit fee is taken

Returns:

Type Description
str

Currency

Source code in gemini_api/endpoints/order.py
455
456
457
458
459
460
461
462
463
@property
def deposit_fee_currency(self) -> str:
    """
    Property for the currency in which the deposit fee is taken

    Returns:
        Currency
    """
    return self._deposit_fee_currency

exchange() property

Property for the exchange (always "gemini")

Returns:

Type Description
str

exchange

Source code in gemini_api/endpoints/order.py
202
203
204
205
206
207
208
209
210
@property
def exchange(self) -> str:
    """
    Property for the exchange (always "gemini")

    Returns:
        exchange
    """
    return self._exchange

executed_amount() property

Property for the amount of the order that has been filled

Returns:

Type Description
float

Executed amount

Source code in gemini_api/endpoints/order.py
319
320
321
322
323
324
325
326
327
@property
def executed_amount(self) -> float:
    """
    Property for the amount of the order that has been filled

    Returns:
        Executed amount
    """
    return self._executed_amount

fee() property

Property for the fee amount charged

Returns:

Type Description
str

Fee

Source code in gemini_api/endpoints/order.py
423
424
425
426
427
428
429
430
431
@property
def fee(self) -> str:
    """
    Property for the fee amount charged

    Returns:
        Fee
    """
    return self._fee

fee_amount() property

Property for the amount charged

Returns:

Type Description
str

Fee

Source code in gemini_api/endpoints/order.py
475
476
477
478
479
480
481
482
483
@property
def fee_amount(self) -> str:
    """
    Property for the amount charged

    Returns:
        Fee
    """
    return self._fee_amount

fee_currency() property

Property for the currency that the fee was paid in

Returns:

Type Description
str

Currency

Source code in gemini_api/endpoints/order.py
433
434
435
436
437
438
439
440
441
@property
def fee_currency(self) -> str:
    """
    Property for the currency that the fee was paid in

    Returns:
        Currency
    """
    return self._fee_currency

get_active_orders(auth) classmethod

Method to get active orders

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required

Returns:

Type Description
List[Order]

List of Order objects

Source code in gemini_api/endpoints/order.py
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
@classmethod
def get_active_orders(cls, auth: Authentication) -> List[Order]:

    """
    Method to get active orders

    Args:
        auth: Gemini authentication object

    Returns:
        List of Order objects
    """
    path = "/v1/orders"

    res = auth.make_request(endpoint=path)

    all_active_orders = []

    for i in range(len(res)):
        order = Order(auth=auth, order_data=res[i])
        all_active_orders.append(order)

    return all_active_orders

get_past_trades(auth, symbol, since=None, limit_trades=None) classmethod

Method to get past trades

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
symbol str

Trading pair

required
since str

Date in YYYYMMDD format

None
limit_trades int

Maximum number of trades to return, min 50 max 500

None

Returns:

Type Description
List[Order]

List of Order objects

Source code in gemini_api/endpoints/order.py
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
@classmethod
def get_past_trades(
    cls,
    auth: Authentication,
    symbol: str,
    since: str = None,
    limit_trades: int = None,
) -> List[Order]:

    """
    Method to get past trades

    Args:
        auth: Gemini authentication object
        symbol: Trading pair
        since: Date in YYYYMMDD format
        limit_trades: Maximum number of trades to return, min 50 max 500

    Returns:
        List of Order objects
    """
    path = "/v1/mytrades"

    data: Dict[str, Any] = {
        "symbol": symbol,
    }

    if since is not None:
        data["timestamp"] = date_to_unix_ts(since)
    if limit_trades is not None:
        data["limit_trades"] = limit_trades

    res = auth.make_request(endpoint=path, payload=data)

    all_past_trades = []

    for i in range(len(res)):
        past_trade = Order(auth=auth, order_data=res[i])
        all_past_trades.append(past_trade)

    return all_past_trades

heartbeat() property

Property for the heartbeat if set as an option in api settings which always returns "ok"

Returns:

Type Description
str

Result

Source code in gemini_api/endpoints/order.py
526
527
528
529
530
531
532
533
534
535
@property
def heartbeat(self) -> str:
    """
    Property for the heartbeat if set as an option in api settings
    which always returns "ok"

    Returns:
        Result
    """
    return self._result

id() property

Property for the ID

Returns:

Type Description
str

ID

Source code in gemini_api/endpoints/order.py
172
173
174
175
176
177
178
179
180
@property
def id(self) -> str:
    """
    Property for the ID

    Returns:
        ID
    """
    return self._id

is_auction_fill() property

Property for the auction status

Returns:

Type Description
bool

True if the trade was filled at an auction, False otherwise

Source code in gemini_api/endpoints/order.py
495
496
497
498
499
500
501
502
503
@property
def is_auction_fill(self) -> bool:
    """
    Property for the auction status

    Returns:
        True if the trade was filled at an auction, False otherwise
    """
    return self._is_auction_fill

is_cancelled() property

Property for the cancelled status of an order

Returns:

Type Description
bool

True if the order has been canceled

Source code in gemini_api/endpoints/order.py
288
289
290
291
292
293
294
295
296
@property
def is_cancelled(self) -> bool:
    """
    Property for the cancelled status of an order

    Returns:
        True if the order has been canceled
    """
    return self._is_cancelled

is_clearing_fill() property

Property for the clearing status

Returns:

Type Description
bool

True if the trade was a clearing trade at and not on an

bool

on-exchange trade, False otherwise

Source code in gemini_api/endpoints/order.py
505
506
507
508
509
510
511
512
513
514
@property
def is_clearing_fill(self) -> bool:
    """
    Property for the clearing status

    Returns:
        True if the trade was a clearing trade at and not on an
        on-exchange trade, False otherwise
    """
    return self._is_clearing_fill

is_hidden() property

Property for the hidden status of an order

Returns:

Type Description
bool

Will always return false unless the order was placed with

bool

the indication-of-interest execution option.

Source code in gemini_api/endpoints/order.py
298
299
300
301
302
303
304
305
306
307
@property
def is_hidden(self) -> bool:
    """
    Property for the hidden status of an order

    Returns:
        Will always return false unless the order was placed with
        the indication-of-interest execution option.
    """
    return self._is_hidden

is_live() property

Property for the active status of an order

Returns:

Type Description
bool

True if the order is on the book (has remaining quantity

bool

and has not been canceled), false otherwise

Source code in gemini_api/endpoints/order.py
277
278
279
280
281
282
283
284
285
286
@property
def is_live(self) -> bool:
    """
    Property for the active status of an order

    Returns:
        True if the order is on the book (has remaining quantity
        and has not been canceled), false otherwise
    """
    return self._is_live

message() property

Property for the error message

Returns:

Type Description
str

Error message description

Source code in gemini_api/endpoints/order.py
557
558
559
560
561
562
563
564
565
@property
def message(self) -> str:
    """
    Property for the error message

    Returns:
        Error message description
    """
    return self._message

new_order(auth, symbol, amount, price, side, options=[], stop_limit=False, stop_price=None, client_order_id=None) classmethod

Method to create a new limit or stop-limit order

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
symbol str

Trading pair

required
amount str

Quoted decimal amount to purchase

required
price str

Quoted decimal amount to spend per unit

required
options List[str]

Option of order execution, defaults to limit order

[]
stop_price Optional[str]

The price to trigger a stop-limit order

None
stop_limit bool

True if stop_price is provided

False
client_order_id str

Client-specified order if

None

Returns:

Type Description
Order

Order object

Source code in gemini_api/endpoints/order.py
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
@classmethod
def new_order(
    cls,
    auth: Authentication,
    symbol: str,
    amount: str,
    price: str,
    side: str,
    options: List[str] = [],
    stop_limit: bool = False,
    stop_price: Optional[str] = None,
    client_order_id: str = None,
) -> Order:
    """
    Method to create a new limit or stop-limit order

    Args:
        auth: Gemini authentication object
        symbol: Trading pair
        amount: Quoted decimal amount to purchase
        price: Quoted decimal amount to spend per unit
        options: Option of order execution, defaults to limit order
        stop_price: The price to trigger a stop-limit order
        stop_limit: True if stop_price is provided
        client_order_id: Client-specified order if

    Returns:
        Order object
    """
    path = "/v1/order/new"

    data: Union[Dict[Any, Any], Any] = {
        "symbol": symbol,
        "amount": amount,
        "price": price,
        "side": side,
        "options": options,
        "type": "exchange limit",
    }
    if stop_limit:
        data["type"] = "exchange stop limit"
        data["stop_price"] = stop_price

    if client_order_id is not None:
        data["client_order_id"] = client_order_id

    res = auth.make_request(endpoint=path, payload=data)
    return Order(auth=auth, order_data=res)

options() property

Property for the options containing at most one supported order execution option

Returns:

Type Description
List[str]

Options

Source code in gemini_api/endpoints/order.py
339
340
341
342
343
344
345
346
347
348
@property
def options(self) -> List[str]:
    """
    Property for the options containing at most one supported
    order execution option

    Returns:
        Options
    """
    return self._options

order_id() property

Property for the order ID

Returns:

Type Description
Union[str, Dict[int, bool]]

Order ID

Source code in gemini_api/endpoints/order.py
162
163
164
165
166
167
168
169
170
@property
def order_id(self) -> Union[str, Dict[int, bool]]:
    """
    Property for the order ID

    Returns:
        Order ID
    """
    return self._order_id

order_status(auth, order_id, include_trades, client_order_id=None) classmethod

Method to get order status

The order id to get information on - cannot be used in combination with client_order_id

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
order_id str

The order id

required
include_trades bool

Include trade details of all fills from the order

required
client_order_id str

Client-specified order

None

Returns:

Type Description
Order

Order object

Source code in gemini_api/endpoints/order.py
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
@classmethod
def order_status(
    cls,
    auth: Authentication,
    order_id: str,
    include_trades: bool,
    client_order_id: str = None,
) -> Order:

    """
    Method to get order status

    The order id to get information on - cannot be
    used in combination with client_order_id

    Args:
        auth: Gemini authentication object
        order_id: The order id
        include_trades: Include trade details of all fills from the order
        client_order_id: Client-specified order

    Returns:
        Order object
    """
    path = "/v1/order/status"

    data = {
        "order_id": order_id,
        "include_trades": include_trades,
    }

    if client_order_id is not None:
        data["client_order_id"] = client_order_id

    res = auth.make_request(endpoint=path, payload=data)
    return Order(auth=auth, order_data=res)

order_type() property

Property for the description of the type: exchange limit, auction-only exchange limit, market buy, market sell, indication-of-interest

Returns:

Type Description
str

type

Source code in gemini_api/endpoints/order.py
233
234
235
236
237
238
239
240
241
242
243
@property
def order_type(self) -> str:
    """
    Property for the description of the type:
    exchange limit, auction-only exchange limit, market buy,
    market sell, indication-of-interest

    Returns:
        type
    """
    return self._order_type

original_amount() property

Property for the originally submitted amount of the order.

Returns:

Type Description
str

Original amount

Source code in gemini_api/endpoints/order.py
360
361
362
363
364
365
366
367
368
@property
def original_amount(self) -> str:
    """
    Property for the originally submitted amount of the order.

    Returns:
        Original amount
    """
    return self._original_amount

price() property

Property for the price the order was issued at

Returns:

Type Description
str

Price

Source code in gemini_api/endpoints/order.py
350
351
352
353
354
355
356
357
358
@property
def price(self) -> str:
    """
    Property for the price the order was issued at

    Returns:
        Price
    """
    return self._price

price_currency() property

Property for the price_currency

Returns:

Type Description
str

price_currency

Source code in gemini_api/endpoints/order.py
370
371
372
373
374
375
376
377
378
@property
def price_currency(self) -> str:
    """
    Property for the price_currency

    Returns:
        price_currency
    """
    return self._price_currency

quantity() property

Property for the quantity

Returns:

Type Description
str

quantity

Source code in gemini_api/endpoints/order.py
380
381
382
383
384
385
386
387
388
@property
def quantity(self) -> str:
    """
    Property for the quantity

    Returns:
        quantity
    """
    return self._quantity

quantity_currency() property

Property for the currency quantity label for the quantity field in wrap orders - matches 'CCY1' in the symbol

Returns:

Type Description
str

Currency quantity label

Source code in gemini_api/endpoints/order.py
390
391
392
393
394
395
396
397
398
399
@property
def quantity_currency(self) -> str:
    """
    Property for the currency quantity label for the quantity field
    in wrap orders - matches 'CCY1' in the symbol

    Returns:
        Currency quantity label
    """
    return self._quantity_currency

reason() property

Property for the reason of errors

Returns:

Type Description
str

Short error description

Source code in gemini_api/endpoints/order.py
547
548
549
550
551
552
553
554
555
@property
def reason(self) -> str:
    """
    Property for the reason of errors

    Returns:
        Short error description
    """
    return self._reason

remaining_amount() property

Property for the amount of the order that has not been filled

Returns:

Type Description
str

Remaining amount

Source code in gemini_api/endpoints/order.py
329
330
331
332
333
334
335
336
337
@property
def remaining_amount(self) -> str:
    """
    Property for the amount of the order that has not been filled

    Returns:
        Remaining amount
    """
    return self._remaining_amount

result() property

Property for the result upon errors or the state of a request

Returns:

Type Description
str

Result

Source code in gemini_api/endpoints/order.py
537
538
539
540
541
542
543
544
545
@property
def result(self) -> str:
    """
    Property for the result upon errors or the state of a request

    Returns:
        Result
    """
    return self._result

revive_heartbeat(auth) classmethod

Method to revive the heartbeat

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required

Returns:

Type Description
Order

Order object

Source code in gemini_api/endpoints/order.py
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
@classmethod
def revive_heartbeat(
    cls,
    auth: Authentication,
) -> Order:

    """
    Method to revive the heartbeat

    Args:
        auth: Gemini authentication object

    Returns:
        Order object
    """
    path = "/v1/heartbeat"

    res = auth.make_request(endpoint=path)

    return Order(auth=auth, order_data=res)

side() property

Property for the side (either "buy" or "sell")

Returns:

Type Description
str

Side

Source code in gemini_api/endpoints/order.py
223
224
225
226
227
228
229
230
231
@property
def side(self) -> str:
    """
    Property for the side (either "buy" or "sell")

    Returns:
        Side
    """
    return self._side

symbol() property

Property for the symbol of the order

Returns:

Type Description
str

Symbol

Source code in gemini_api/endpoints/order.py
192
193
194
195
196
197
198
199
200
@property
def symbol(self) -> str:
    """
    Property for the symbol of the order

    Returns:
        Symbol
    """
    return self._symbol

timestamp() property

Property for the timestamp the order was submitted. Note that for compatibility reasons, this is returned as a string. Recommend using the timestampms field instead

Returns:

Type Description
str

The number of seconds since 1970-01-01 UTC (unix epoch)

Source code in gemini_api/endpoints/order.py
245
246
247
248
249
250
251
252
253
254
255
@property
def timestamp(self) -> str:
    """
    Property for the  timestamp the order was submitted. Note that
    for compatibility reasons, this is returned as a string.
    Recommend using the timestampms field instead

    Returns:
        The number of seconds since 1970-01-01 UTC (unix epoch)
    """
    return self._timestamp

timestampms() property

Property for the timestamp the order was submitted in milliseconds

Returns:

Type Description
int

The number of milliseconds since 1970-01-01 UTC

Source code in gemini_api/endpoints/order.py
257
258
259
260
261
262
263
264
265
@property
def timestampms(self) -> int:
    """
    Property for the timestamp the order was submitted in milliseconds

    Returns:
        The number of milliseconds since 1970-01-01 UTC
    """
    return self._timestampms

total_spend() property

Property for the total quantity to spend for the order - will be the sum inclusive of all fees and amount to be traded

Returns:

Type Description
str

Total spend

Source code in gemini_api/endpoints/order.py
401
402
403
404
405
406
407
408
409
410
@property
def total_spend(self) -> str:
    """
    Property for the total quantity to spend for the order - will be
    the sum inclusive of all fees and amount to be traded

    Returns:
        Total spend
    """
    return self._total_spend

total_spend_currency() property

Property for the currency of the total spend to be spent on the order

Returns:

Type Description
str

Total spend currency

Source code in gemini_api/endpoints/order.py
412
413
414
415
416
417
418
419
420
421
@property
def total_spend_currency(self) -> str:
    """
    Property for the currency of the total spend to be spent on the
    order

    Returns:
        Total spend currency
    """
    return self._total_spend_currency

trade_id() property

Property for the unique trade id

Returns:

Type Description
int

Trade id

Source code in gemini_api/endpoints/order.py
485
486
487
488
489
490
491
492
493
@property
def trade_id(self) -> int:
    """
    Property for the unique trade id

    Returns:
        Trade id
    """
    return self._trade_id

trades() property

Property for the trades containing trade details

Returns:

Type Description
List[Dict[str, Any]]

List of trade dictionary objects

Source code in gemini_api/endpoints/order.py
267
268
269
270
271
272
273
274
275
@property
def trades(self) -> List[Dict[str, Any]]:
    """
    Property for the trades containing trade details

    Returns:
        List of trade dictionary objects
    """
    return self._trades

was_forced() property

Property for the forced status of an order (always False)

Returns:

Type Description
bool

False.

Source code in gemini_api/endpoints/order.py
309
310
311
312
313
314
315
316
317
@property
def was_forced(self) -> bool:
    """
    Property for the forced status of an order (always False)

    Returns:
        False.
    """
    return self._was_forced

wrap_order(auth, amount, side, symbol, client_order_id=None) classmethod

Method to wrap or unwrap Gemini isued assets

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
amount str

Amount of currency to purchase

required
side str

Either "buy" or "sell"

required
symbol str

Trading pair

required
client_order_id str

Client-specified order id

None

Returns:

Type Description
Order

Order object

Source code in gemini_api/endpoints/order.py
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
@classmethod
def wrap_order(
    cls,
    auth: Authentication,
    amount: str,
    side: str,
    symbol: str,
    client_order_id: str = None,
) -> Order:
    """
    Method to wrap or unwrap Gemini isued assets

    Args:
        auth: Gemini authentication object
        amount: Amount of currency to purchase
        side: Either "buy" or "sell"
        symbol: Trading pair
        client_order_id: Client-specified order id

    Returns:
        Order object
    """
    path = f"/v1/order/{symbol}"

    data = {
        "amount": amount,
        "side": side,
        "client_order_id": client_order_id,
    }

    if client_order_id is not None:
        data["client_order_id"] = client_order_id

    res = auth.make_request(endpoint=path, payload=data)
    return Order(auth=auth, order_data=res)

Fee and Volume APIs

FeeVolume

Class that manages Fee and Volumes APIs

Source code in gemini_api/endpoints/fee_volume.py
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
class FeeVolume:
    """
    Class that manages Fee and Volumes APIs
    """

    __slots__ = [
        "_date",
        "_last_updated_ms",
        "_web_maker_fee_bps",
        "_web_taker_fee_bps",
        "_web_auction_fee_bps",
        "_api_maker_fee_bps",
        "_api_taker_fee_bps",
        "_api_auction_fee_bps",
        "_fix_maker_fee_bps",
        "_fix_taker_fee_bps",
        "_fix_auction_fee_bps",
        "_block_maker_fee_bps",
        "_block_taker_fee_bps",
        "_notional_30d_volume",
        "_notional_1d_volume",
        "_notional_1d_volume_date",
        "_notional_1d_volume_notional_volume",
        "_symbol",
        "_base_currency",
        "_notional_currency",
        "_data_date",
        "_total_volume_base",
        "_maker_buy_sell_ratio",
        "_buy_maker_base",
        "_buy_maker_notional",
        "_buy_maker_count",
        "_sell_maker_base",
        "_sell_maker_notional",
        "_sell_maker_count",
        "_buy_taker_base",
        "_buy_taker_notional",
        "_buy_taker_count",
        "_sell_taker_base",
        "_sell_taker_notional",
        "_sell_taker_count",
        "_result",
        "_reason",
        "_message",
    ]

    def __init__(
        self, auth: Authentication, volume_data: Dict[str, Any]
    ) -> None:
        """
        Initialise FeeVolume class
        """
        if "date" in volume_data:
            self._date: str = volume_data["date"]
        if "last_updated_ms" in volume_data:
            self._last_updated_ms: int = volume_data["last_updated_ms"]
        if "web_maker_fee_bps" in volume_data:
            self._web_maker_fee_bps: int = volume_data["web_maker_fee_bps"]
        if "web_taker_fee_bps" in volume_data:
            self._web_taker_fee_bps: int = volume_data["web_taker_fee_bps"]
        if "web_auction_fee_bps" in volume_data:
            self._web_auction_fee_bps: int = volume_data["web_auction_fee_bps"]
        if "api_maker_fee_bps" in volume_data:
            self._api_maker_fee_bps: int = volume_data["api_maker_fee_bps"]
        if "api_taker_fee_bps" in volume_data:
            self._api_taker_fee_bps: int = volume_data["api_taker_fee_bps"]
        if "api_auction_fee_bps" in volume_data:
            self._api_auction_fee_bps: int = volume_data["api_auction_fee_bps"]
        if "fix_maker_fee_bps" in volume_data:
            self._fix_maker_fee_bps: int = volume_data["fix_maker_fee_bps"]
        if "fix_taker_fee_bps" in volume_data:
            self._fix_taker_fee_bps: int = volume_data["fix_taker_fee_bps"]
        if "fix_auction_fee_bps" in volume_data:
            self._fix_auction_fee_bps: int = volume_data["fix_auction_fee_bps"]
        if "block_maker_fee_bps" in volume_data:
            self._block_maker_fee_bps: int = volume_data["block_maker_fee_bps"]
        if "block_taker_fee_bps" in volume_data:
            self._block_taker_fee_bps: int = volume_data["block_taker_fee_bps"]
        if "notional_30d_volume" in volume_data:
            self._notional_30d_volume: int = volume_data["notional_30d_volume"]
        if "notional_1d_volume" in volume_data:
            self._notional_1d_volume: List[Dict[str, Any]] = volume_data[
                "notional_1d_volume"
            ]
        if "symbol" in volume_data:
            self._symbol: str = volume_data["symbol"]
        if "base_currency" in volume_data:
            self._base_currency: float = volume_data["base_currency"]
        if "notional_currency" in volume_data:
            self._notional_currency: float = volume_data["notional_currency"]
        if "data_date" in volume_data:
            self._data_date: str = volume_data["data_date"]
        if "total_volume_base" in volume_data:
            self._total_volume_base: float = volume_data["total_volume_base"]
        if "maker_buy_sell_ratio" in volume_data:
            self._maker_buy_sell_ratio: float = volume_data[
                "maker_buy_sell_ratio"
            ]
        if "buy_maker_base" in volume_data:
            self._buy_maker_base: float = volume_data["buy_maker_base"]
        if "buy_maker_notional" in volume_data:
            self._buy_maker_notional: float = volume_data["buy_maker_notional"]
        if "buy_maker_count" in volume_data:
            self._buy_maker_count: float = volume_data["buy_maker_count"]
        if "sell_maker_base" in volume_data:
            self._sell_maker_base: float = volume_data["sell_maker_base"]
        if "sell_maker_notional" in volume_data:
            self._sell_maker_notional: float = volume_data[
                "sell_maker_notional"
            ]
        if "sell_maker_count" in volume_data:
            self._sell_maker_count: float = volume_data["sell_maker_count"]
        if "buy_taker_base" in volume_data:
            self._buy_taker_base: float = volume_data["buy_taker_base"]
        if "buy_taker_notional" in volume_data:
            self._buy_taker_notional: float = volume_data["buy_taker_notional"]
        if "buy_taker_count" in volume_data:
            self._buy_taker_count: float = volume_data["buy_taker_count"]
        if "sell_taker_base" in volume_data:
            self._sell_taker_base: float = volume_data["sell_taker_base"]
        if "sell_taker_notional" in volume_data:
            self._sell_taker_notional: float = volume_data[
                "sell_taker_notional"
            ]
        if "sell_taker_count" in volume_data:
            self._sell_taker_count: float = volume_data["sell_taker_count"]
        if "result" in volume_data:
            self._result: str = volume_data["result"]
        if "reason" in volume_data:
            self._reason: str = volume_data["reason"]
        if "message" in volume_data:
            self._message: str = volume_data["message"]

    @property
    def date(self) -> str:
        """
        Property for the UTC date

        Returns:
            date in yyyy-mm-dd format
        """
        return self._date

    @property
    def last_updated_ms(self) -> int:
        """
        Property for the last update timestamp

        Returns:
            Unix timestamp in millisecond of the last update
        """
        return self._last_updated_ms

    @property
    def web_maker_fee_bps(self) -> int:
        """
        Property for the web maker fee

        Returns:
            Maker fee for all symbols in basis point for web orders
        """
        return self._web_maker_fee_bps

    @property
    def web_taker_fee_bps(self) -> int:
        """
        Property for the web taker fee

        Returns:
            Taker fee for all symbols in basis point for web orders
        """
        return self._web_taker_fee_bps

    @property
    def web_auction_fee_bps(self) -> int:
        """
        Property for the web auction fee

        Returns:
            Auction fee for all symbols in basis point for web orders
        """
        return self._web_auction_fee_bps

    @property
    def api_maker_fee_bps(self) -> int:
        """
        Property for the api maker fee

        Returns:
            Maker fee for all symbols in basis point for API orders
        """
        return self._api_maker_fee_bps

    @property
    def api_taker_fee_bps(self) -> int:
        """
        Property for the api taker fee
        Returns:
            Taker fee for all symbols in basis point for API orders
        """
        return self._api_taker_fee_bps

    @property
    def api_auction_fee_bps(self) -> int:
        """
        Property for the api auction fee

        Returns:
            Auction fee for all symbols in basis point for API orders
        """
        return self._api_auction_fee_bps

    @property
    def fix_maker_fee_bps(self) -> int:
        """
        Property for the fix maker fee

        Returns:
            Maker fee for all symbols in basis point for FIX orders
        """
        return self._fix_maker_fee_bps

    @property
    def fix_taker_fee_bps(self) -> int:
        """
        Property for the fix taken fee

        Returns:
            Taker fee for all symbols in basis point for FIX orders
        """
        return self._fix_taker_fee_bps

    @property
    def fix_auction_fee_bps(self) -> int:
        """
        Property for the fix auction fee

        Returns:
            Auction fee for all symbols in basis point for FIX orders
        """
        return self._fix_auction_fee_bps

    @property
    def block_maker_fee_bps(self) -> int:
        """
        Property for the block maker fee

        Returns:
            Maker fee for all symbols in basis point for block orders
        """
        return self._block_maker_fee_bps

    @property
    def block_taker_fee_bps(self) -> int:
        """
        Property for the block taker fee

        Returns:
            Taker fee for all symbols in basis point for block orders
        """
        return self._block_taker_fee_bps

    @property
    def notional_30d_volume(self) -> float:
        """
        Property for the notional 30 day trading volume for the past
        30 days, including auction volume

        Returns:
            Maker plus taker trading volume
        """
        return self._notional_30d_volume

    @property
    def notional_1d_volume(self) -> List[Dict[str, Any]]:
        """
        Property for the 1 day notional 1 day trading volume for the past
        30 days

        Returns:
            List of 1 day notional volumes
        """
        return self._notional_1d_volume

    @property
    def symbol(self) -> str:
        """
        Property for the symbol

        Returns:
            Symbol
        """
        return self._symbol

    @property
    def base_currency(self) -> float:
        """
        Property for the base currency that the quantity is denominated in

        Returns:
            Base currency
        """
        return self._base_currency

    @property
    def notional_currency(self) -> float:
        """
        Property for the notional currency - price is denominated as
        the amount of notional currency per one unit of base currency

        Returns:
            Notional currency
        """
        return self._notional_currency

    @property
    def data_date(self) -> str:
        """
        Property for the data date

        Returns:
            UTC date in yyyy-mm-dd format
        """
        return self._data_date

    @property
    def total_volume_base(self) -> float:
        """
        Property for the total volume base

        Returns:
            Total trade volume for this day
        """
        return self._total_volume_base

    @property
    def maker_buy_sell_ratio(self) -> float:
        """
        Property for the maker buy/sell ratio - the proportion of maker
        base volume on trades where the account was on the buy side
        versus all maker trades. If no maker base volume on the buy
        side, then this value is 0

        Returns:
            Maker buy/sell ratio
        """
        return self._maker_buy_sell_ratio

    @property
    def buy_maker_base(self) -> float:
        """
        Property for the buy maker base where the account was a maker
        on the buy side of the trade

        Returns:
            Quantity for this day
        """
        return self._buy_maker_base

    @property
    def buy_maker_notional(self) -> float:
        """
        Property for the notional value where the account was a maker
        on the buy side of the trade

        Returns:
            Notional value for this day
        """
        return self._buy_maker_notional

    @property
    def buy_maker_count(self) -> float:
        """
        Property for the buy maker count where the account was a maker
        on the buy side of the trade

        Returns:
            Number of trades for this day
        """
        return self._buy_maker_count

    @property
    def sell_maker_base(self) -> float:
        """
        Property for the sell maker base where the account was a maker
        on the sell side of the trade

        Returns:
            Quantity for this day
        """
        return self._sell_maker_base

    @property
    def sell_maker_notional(self) -> float:
        """
        Property for the sell maker notional value where the account
        was a maker on the sell side of the trade

        Returns:
            Notional value for this day
        """
        return self._sell_maker_notional

    @property
    def sell_maker_count(self) -> float:
        """
        Property for the sell maker count where the account was a maker
        on the sell side of the trade

        Returns:
            Number of trades for this day
        """
        return self._sell_maker_count

    @property
    def buy_taker_base(self) -> float:
        """
        Property for the buy taker base value where the account was a
        taker on the buy side of the trade

        Returns:
            Quantity for this day
        """
        return self._buy_taker_base

    @property
    def buy_taker_notional(self) -> float:
        """
        Property for the buy taker notional value where the account was
        a taker on the buy side of the trade

        Returns:
            Notional value for this day
        """
        return self._buy_taker_notional

    @property
    def buy_taker_count(self) -> float:
        """
        Property for the buy taker count where the account was a taker
        on the buy side of the trade

        Returns:
            Number of trades for this day
        """
        return self._buy_taker_count

    @property
    def sell_taker_base(self) -> float:
        """
        Property for the sell taker base where the account was a taker
        on the sell side of the trade

        Returns:
            Quantity for this day
        """
        return self._sell_taker_base

    @property
    def sell_taker_notional(self) -> float:
        """
        Property for the sell taker notional value where the account was
        a taker on the sell side of the trade

        Returns:
            Notional value for this day
        """
        return self._sell_taker_notional

    @property
    def sell_taker_count(self) -> float:
        """
        Property for the sell taker count where the account was a taker
        on the sell side of the trade

        Returns:
            Number of trades for this day
        """
        return self.sell_taker_count

    @property
    def result(self) -> str:
        """
        Property for the result upon errors or the state of a request

        Returns:
            Result
        """
        return self._result

    @property
    def reason(self) -> str:
        """
        Property for the reason of errors

        Returns:
            Short error description
        """
        return self._reason

    @property
    def message(self) -> str:
        """
        Property for the error message

        Returns:
            Error message description
        """
        return self._message

    @classmethod
    def get_notional_volume(cls, auth: Authentication) -> Optional[FeeVolume]:
        """
        Method to get the notional volume in price currency that has
        been traded across all pairs over a period of 30 days.

        Args:
            auth: Gemini authentication object

        Returns:
            FeeVolume object

        """
        path = "/v1/notionalvolume"

        res = auth.make_request(endpoint=path)
        return FeeVolume(auth=auth, volume_data=res)

    @classmethod
    def get_trade_volume(cls, auth: Authentication) -> List[FeeVolume]:
        """
        Method to
        Args:
            auth: Gemini authentication object

        Returns:
            FeeVolume object

        """
        path = "/v1/tradevolume"

        res = auth.make_request(endpoint=path)

        all_trade_volume = []

        for i in range(len(res[0])):
            trade_volume = FeeVolume(auth=auth, volume_data=res[0][i])
            all_trade_volume.append(trade_volume)

        return all_trade_volume

__init__(auth, volume_data)

Initialise FeeVolume class

Source code in gemini_api/endpoints/fee_volume.py
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
def __init__(
    self, auth: Authentication, volume_data: Dict[str, Any]
) -> None:
    """
    Initialise FeeVolume class
    """
    if "date" in volume_data:
        self._date: str = volume_data["date"]
    if "last_updated_ms" in volume_data:
        self._last_updated_ms: int = volume_data["last_updated_ms"]
    if "web_maker_fee_bps" in volume_data:
        self._web_maker_fee_bps: int = volume_data["web_maker_fee_bps"]
    if "web_taker_fee_bps" in volume_data:
        self._web_taker_fee_bps: int = volume_data["web_taker_fee_bps"]
    if "web_auction_fee_bps" in volume_data:
        self._web_auction_fee_bps: int = volume_data["web_auction_fee_bps"]
    if "api_maker_fee_bps" in volume_data:
        self._api_maker_fee_bps: int = volume_data["api_maker_fee_bps"]
    if "api_taker_fee_bps" in volume_data:
        self._api_taker_fee_bps: int = volume_data["api_taker_fee_bps"]
    if "api_auction_fee_bps" in volume_data:
        self._api_auction_fee_bps: int = volume_data["api_auction_fee_bps"]
    if "fix_maker_fee_bps" in volume_data:
        self._fix_maker_fee_bps: int = volume_data["fix_maker_fee_bps"]
    if "fix_taker_fee_bps" in volume_data:
        self._fix_taker_fee_bps: int = volume_data["fix_taker_fee_bps"]
    if "fix_auction_fee_bps" in volume_data:
        self._fix_auction_fee_bps: int = volume_data["fix_auction_fee_bps"]
    if "block_maker_fee_bps" in volume_data:
        self._block_maker_fee_bps: int = volume_data["block_maker_fee_bps"]
    if "block_taker_fee_bps" in volume_data:
        self._block_taker_fee_bps: int = volume_data["block_taker_fee_bps"]
    if "notional_30d_volume" in volume_data:
        self._notional_30d_volume: int = volume_data["notional_30d_volume"]
    if "notional_1d_volume" in volume_data:
        self._notional_1d_volume: List[Dict[str, Any]] = volume_data[
            "notional_1d_volume"
        ]
    if "symbol" in volume_data:
        self._symbol: str = volume_data["symbol"]
    if "base_currency" in volume_data:
        self._base_currency: float = volume_data["base_currency"]
    if "notional_currency" in volume_data:
        self._notional_currency: float = volume_data["notional_currency"]
    if "data_date" in volume_data:
        self._data_date: str = volume_data["data_date"]
    if "total_volume_base" in volume_data:
        self._total_volume_base: float = volume_data["total_volume_base"]
    if "maker_buy_sell_ratio" in volume_data:
        self._maker_buy_sell_ratio: float = volume_data[
            "maker_buy_sell_ratio"
        ]
    if "buy_maker_base" in volume_data:
        self._buy_maker_base: float = volume_data["buy_maker_base"]
    if "buy_maker_notional" in volume_data:
        self._buy_maker_notional: float = volume_data["buy_maker_notional"]
    if "buy_maker_count" in volume_data:
        self._buy_maker_count: float = volume_data["buy_maker_count"]
    if "sell_maker_base" in volume_data:
        self._sell_maker_base: float = volume_data["sell_maker_base"]
    if "sell_maker_notional" in volume_data:
        self._sell_maker_notional: float = volume_data[
            "sell_maker_notional"
        ]
    if "sell_maker_count" in volume_data:
        self._sell_maker_count: float = volume_data["sell_maker_count"]
    if "buy_taker_base" in volume_data:
        self._buy_taker_base: float = volume_data["buy_taker_base"]
    if "buy_taker_notional" in volume_data:
        self._buy_taker_notional: float = volume_data["buy_taker_notional"]
    if "buy_taker_count" in volume_data:
        self._buy_taker_count: float = volume_data["buy_taker_count"]
    if "sell_taker_base" in volume_data:
        self._sell_taker_base: float = volume_data["sell_taker_base"]
    if "sell_taker_notional" in volume_data:
        self._sell_taker_notional: float = volume_data[
            "sell_taker_notional"
        ]
    if "sell_taker_count" in volume_data:
        self._sell_taker_count: float = volume_data["sell_taker_count"]
    if "result" in volume_data:
        self._result: str = volume_data["result"]
    if "reason" in volume_data:
        self._reason: str = volume_data["reason"]
    if "message" in volume_data:
        self._message: str = volume_data["message"]

api_auction_fee_bps() property

Property for the api auction fee

Returns:

Type Description
int

Auction fee for all symbols in basis point for API orders

Source code in gemini_api/endpoints/fee_volume.py
210
211
212
213
214
215
216
217
218
@property
def api_auction_fee_bps(self) -> int:
    """
    Property for the api auction fee

    Returns:
        Auction fee for all symbols in basis point for API orders
    """
    return self._api_auction_fee_bps

api_maker_fee_bps() property

Property for the api maker fee

Returns:

Type Description
int

Maker fee for all symbols in basis point for API orders

Source code in gemini_api/endpoints/fee_volume.py
191
192
193
194
195
196
197
198
199
@property
def api_maker_fee_bps(self) -> int:
    """
    Property for the api maker fee

    Returns:
        Maker fee for all symbols in basis point for API orders
    """
    return self._api_maker_fee_bps

api_taker_fee_bps() property

Property for the api taker fee

Returns:

Type Description
int

Taker fee for all symbols in basis point for API orders

Source code in gemini_api/endpoints/fee_volume.py
201
202
203
204
205
206
207
208
@property
def api_taker_fee_bps(self) -> int:
    """
    Property for the api taker fee
    Returns:
        Taker fee for all symbols in basis point for API orders
    """
    return self._api_taker_fee_bps

base_currency() property

Property for the base currency that the quantity is denominated in

Returns:

Type Description
float

Base currency

Source code in gemini_api/endpoints/fee_volume.py
302
303
304
305
306
307
308
309
310
@property
def base_currency(self) -> float:
    """
    Property for the base currency that the quantity is denominated in

    Returns:
        Base currency
    """
    return self._base_currency

block_maker_fee_bps() property

Property for the block maker fee

Returns:

Type Description
int

Maker fee for all symbols in basis point for block orders

Source code in gemini_api/endpoints/fee_volume.py
250
251
252
253
254
255
256
257
258
@property
def block_maker_fee_bps(self) -> int:
    """
    Property for the block maker fee

    Returns:
        Maker fee for all symbols in basis point for block orders
    """
    return self._block_maker_fee_bps

block_taker_fee_bps() property

Property for the block taker fee

Returns:

Type Description
int

Taker fee for all symbols in basis point for block orders

Source code in gemini_api/endpoints/fee_volume.py
260
261
262
263
264
265
266
267
268
@property
def block_taker_fee_bps(self) -> int:
    """
    Property for the block taker fee

    Returns:
        Taker fee for all symbols in basis point for block orders
    """
    return self._block_taker_fee_bps

buy_maker_base() property

Property for the buy maker base where the account was a maker on the buy side of the trade

Returns:

Type Description
float

Quantity for this day

Source code in gemini_api/endpoints/fee_volume.py
356
357
358
359
360
361
362
363
364
365
@property
def buy_maker_base(self) -> float:
    """
    Property for the buy maker base where the account was a maker
    on the buy side of the trade

    Returns:
        Quantity for this day
    """
    return self._buy_maker_base

buy_maker_count() property

Property for the buy maker count where the account was a maker on the buy side of the trade

Returns:

Type Description
float

Number of trades for this day

Source code in gemini_api/endpoints/fee_volume.py
378
379
380
381
382
383
384
385
386
387
@property
def buy_maker_count(self) -> float:
    """
    Property for the buy maker count where the account was a maker
    on the buy side of the trade

    Returns:
        Number of trades for this day
    """
    return self._buy_maker_count

buy_maker_notional() property

Property for the notional value where the account was a maker on the buy side of the trade

Returns:

Type Description
float

Notional value for this day

Source code in gemini_api/endpoints/fee_volume.py
367
368
369
370
371
372
373
374
375
376
@property
def buy_maker_notional(self) -> float:
    """
    Property for the notional value where the account was a maker
    on the buy side of the trade

    Returns:
        Notional value for this day
    """
    return self._buy_maker_notional

buy_taker_base() property

Property for the buy taker base value where the account was a taker on the buy side of the trade

Returns:

Type Description
float

Quantity for this day

Source code in gemini_api/endpoints/fee_volume.py
422
423
424
425
426
427
428
429
430
431
@property
def buy_taker_base(self) -> float:
    """
    Property for the buy taker base value where the account was a
    taker on the buy side of the trade

    Returns:
        Quantity for this day
    """
    return self._buy_taker_base

buy_taker_count() property

Property for the buy taker count where the account was a taker on the buy side of the trade

Returns:

Type Description
float

Number of trades for this day

Source code in gemini_api/endpoints/fee_volume.py
444
445
446
447
448
449
450
451
452
453
@property
def buy_taker_count(self) -> float:
    """
    Property for the buy taker count where the account was a taker
    on the buy side of the trade

    Returns:
        Number of trades for this day
    """
    return self._buy_taker_count

buy_taker_notional() property

Property for the buy taker notional value where the account was a taker on the buy side of the trade

Returns:

Type Description
float

Notional value for this day

Source code in gemini_api/endpoints/fee_volume.py
433
434
435
436
437
438
439
440
441
442
@property
def buy_taker_notional(self) -> float:
    """
    Property for the buy taker notional value where the account was
    a taker on the buy side of the trade

    Returns:
        Notional value for this day
    """
    return self._buy_taker_notional

data_date() property

Property for the data date

Returns:

Type Description
str

UTC date in yyyy-mm-dd format

Source code in gemini_api/endpoints/fee_volume.py
323
324
325
326
327
328
329
330
331
@property
def data_date(self) -> str:
    """
    Property for the data date

    Returns:
        UTC date in yyyy-mm-dd format
    """
    return self._data_date

date() property

Property for the UTC date

Returns:

Type Description
str

date in yyyy-mm-dd format

Source code in gemini_api/endpoints/fee_volume.py
141
142
143
144
145
146
147
148
149
@property
def date(self) -> str:
    """
    Property for the UTC date

    Returns:
        date in yyyy-mm-dd format
    """
    return self._date

fix_auction_fee_bps() property

Property for the fix auction fee

Returns:

Type Description
int

Auction fee for all symbols in basis point for FIX orders

Source code in gemini_api/endpoints/fee_volume.py
240
241
242
243
244
245
246
247
248
@property
def fix_auction_fee_bps(self) -> int:
    """
    Property for the fix auction fee

    Returns:
        Auction fee for all symbols in basis point for FIX orders
    """
    return self._fix_auction_fee_bps

fix_maker_fee_bps() property

Property for the fix maker fee

Returns:

Type Description
int

Maker fee for all symbols in basis point for FIX orders

Source code in gemini_api/endpoints/fee_volume.py
220
221
222
223
224
225
226
227
228
@property
def fix_maker_fee_bps(self) -> int:
    """
    Property for the fix maker fee

    Returns:
        Maker fee for all symbols in basis point for FIX orders
    """
    return self._fix_maker_fee_bps

fix_taker_fee_bps() property

Property for the fix taken fee

Returns:

Type Description
int

Taker fee for all symbols in basis point for FIX orders

Source code in gemini_api/endpoints/fee_volume.py
230
231
232
233
234
235
236
237
238
@property
def fix_taker_fee_bps(self) -> int:
    """
    Property for the fix taken fee

    Returns:
        Taker fee for all symbols in basis point for FIX orders
    """
    return self._fix_taker_fee_bps

get_notional_volume(auth) classmethod

Method to get the notional volume in price currency that has been traded across all pairs over a period of 30 days.

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required

Returns:

Type Description
Optional[FeeVolume]

FeeVolume object

Source code in gemini_api/endpoints/fee_volume.py
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
@classmethod
def get_notional_volume(cls, auth: Authentication) -> Optional[FeeVolume]:
    """
    Method to get the notional volume in price currency that has
    been traded across all pairs over a period of 30 days.

    Args:
        auth: Gemini authentication object

    Returns:
        FeeVolume object

    """
    path = "/v1/notionalvolume"

    res = auth.make_request(endpoint=path)
    return FeeVolume(auth=auth, volume_data=res)

get_trade_volume(auth) classmethod

Method to

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required

Returns:

Type Description
List[FeeVolume]

FeeVolume object

Source code in gemini_api/endpoints/fee_volume.py
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
@classmethod
def get_trade_volume(cls, auth: Authentication) -> List[FeeVolume]:
    """
    Method to
    Args:
        auth: Gemini authentication object

    Returns:
        FeeVolume object

    """
    path = "/v1/tradevolume"

    res = auth.make_request(endpoint=path)

    all_trade_volume = []

    for i in range(len(res[0])):
        trade_volume = FeeVolume(auth=auth, volume_data=res[0][i])
        all_trade_volume.append(trade_volume)

    return all_trade_volume

last_updated_ms() property

Property for the last update timestamp

Returns:

Type Description
int

Unix timestamp in millisecond of the last update

Source code in gemini_api/endpoints/fee_volume.py
151
152
153
154
155
156
157
158
159
@property
def last_updated_ms(self) -> int:
    """
    Property for the last update timestamp

    Returns:
        Unix timestamp in millisecond of the last update
    """
    return self._last_updated_ms

maker_buy_sell_ratio() property

Property for the maker buy/sell ratio - the proportion of maker base volume on trades where the account was on the buy side versus all maker trades. If no maker base volume on the buy side, then this value is 0

Returns:

Type Description
float

Maker buy/sell ratio

Source code in gemini_api/endpoints/fee_volume.py
343
344
345
346
347
348
349
350
351
352
353
354
@property
def maker_buy_sell_ratio(self) -> float:
    """
    Property for the maker buy/sell ratio - the proportion of maker
    base volume on trades where the account was on the buy side
    versus all maker trades. If no maker base volume on the buy
    side, then this value is 0

    Returns:
        Maker buy/sell ratio
    """
    return self._maker_buy_sell_ratio

message() property

Property for the error message

Returns:

Type Description
str

Error message description

Source code in gemini_api/endpoints/fee_volume.py
508
509
510
511
512
513
514
515
516
@property
def message(self) -> str:
    """
    Property for the error message

    Returns:
        Error message description
    """
    return self._message

notional_1d_volume() property

Property for the 1 day notional 1 day trading volume for the past 30 days

Returns:

Type Description
List[Dict[str, Any]]

List of 1 day notional volumes

Source code in gemini_api/endpoints/fee_volume.py
281
282
283
284
285
286
287
288
289
290
@property
def notional_1d_volume(self) -> List[Dict[str, Any]]:
    """
    Property for the 1 day notional 1 day trading volume for the past
    30 days

    Returns:
        List of 1 day notional volumes
    """
    return self._notional_1d_volume

notional_30d_volume() property

Property for the notional 30 day trading volume for the past 30 days, including auction volume

Returns:

Type Description
float

Maker plus taker trading volume

Source code in gemini_api/endpoints/fee_volume.py
270
271
272
273
274
275
276
277
278
279
@property
def notional_30d_volume(self) -> float:
    """
    Property for the notional 30 day trading volume for the past
    30 days, including auction volume

    Returns:
        Maker plus taker trading volume
    """
    return self._notional_30d_volume

notional_currency() property

Property for the notional currency - price is denominated as the amount of notional currency per one unit of base currency

Returns:

Type Description
float

Notional currency

Source code in gemini_api/endpoints/fee_volume.py
312
313
314
315
316
317
318
319
320
321
@property
def notional_currency(self) -> float:
    """
    Property for the notional currency - price is denominated as
    the amount of notional currency per one unit of base currency

    Returns:
        Notional currency
    """
    return self._notional_currency

reason() property

Property for the reason of errors

Returns:

Type Description
str

Short error description

Source code in gemini_api/endpoints/fee_volume.py
498
499
500
501
502
503
504
505
506
@property
def reason(self) -> str:
    """
    Property for the reason of errors

    Returns:
        Short error description
    """
    return self._reason

result() property

Property for the result upon errors or the state of a request

Returns:

Type Description
str

Result

Source code in gemini_api/endpoints/fee_volume.py
488
489
490
491
492
493
494
495
496
@property
def result(self) -> str:
    """
    Property for the result upon errors or the state of a request

    Returns:
        Result
    """
    return self._result

sell_maker_base() property

Property for the sell maker base where the account was a maker on the sell side of the trade

Returns:

Type Description
float

Quantity for this day

Source code in gemini_api/endpoints/fee_volume.py
389
390
391
392
393
394
395
396
397
398
@property
def sell_maker_base(self) -> float:
    """
    Property for the sell maker base where the account was a maker
    on the sell side of the trade

    Returns:
        Quantity for this day
    """
    return self._sell_maker_base

sell_maker_count() property

Property for the sell maker count where the account was a maker on the sell side of the trade

Returns:

Type Description
float

Number of trades for this day

Source code in gemini_api/endpoints/fee_volume.py
411
412
413
414
415
416
417
418
419
420
@property
def sell_maker_count(self) -> float:
    """
    Property for the sell maker count where the account was a maker
    on the sell side of the trade

    Returns:
        Number of trades for this day
    """
    return self._sell_maker_count

sell_maker_notional() property

Property for the sell maker notional value where the account was a maker on the sell side of the trade

Returns:

Type Description
float

Notional value for this day

Source code in gemini_api/endpoints/fee_volume.py
400
401
402
403
404
405
406
407
408
409
@property
def sell_maker_notional(self) -> float:
    """
    Property for the sell maker notional value where the account
    was a maker on the sell side of the trade

    Returns:
        Notional value for this day
    """
    return self._sell_maker_notional

sell_taker_base() property

Property for the sell taker base where the account was a taker on the sell side of the trade

Returns:

Type Description
float

Quantity for this day

Source code in gemini_api/endpoints/fee_volume.py
455
456
457
458
459
460
461
462
463
464
@property
def sell_taker_base(self) -> float:
    """
    Property for the sell taker base where the account was a taker
    on the sell side of the trade

    Returns:
        Quantity for this day
    """
    return self._sell_taker_base

sell_taker_count() property

Property for the sell taker count where the account was a taker on the sell side of the trade

Returns:

Type Description
float

Number of trades for this day

Source code in gemini_api/endpoints/fee_volume.py
477
478
479
480
481
482
483
484
485
486
@property
def sell_taker_count(self) -> float:
    """
    Property for the sell taker count where the account was a taker
    on the sell side of the trade

    Returns:
        Number of trades for this day
    """
    return self.sell_taker_count

sell_taker_notional() property

Property for the sell taker notional value where the account was a taker on the sell side of the trade

Returns:

Type Description
float

Notional value for this day

Source code in gemini_api/endpoints/fee_volume.py
466
467
468
469
470
471
472
473
474
475
@property
def sell_taker_notional(self) -> float:
    """
    Property for the sell taker notional value where the account was
    a taker on the sell side of the trade

    Returns:
        Notional value for this day
    """
    return self._sell_taker_notional

symbol() property

Property for the symbol

Returns:

Type Description
str

Symbol

Source code in gemini_api/endpoints/fee_volume.py
292
293
294
295
296
297
298
299
300
@property
def symbol(self) -> str:
    """
    Property for the symbol

    Returns:
        Symbol
    """
    return self._symbol

total_volume_base() property

Property for the total volume base

Returns:

Type Description
float

Total trade volume for this day

Source code in gemini_api/endpoints/fee_volume.py
333
334
335
336
337
338
339
340
341
@property
def total_volume_base(self) -> float:
    """
    Property for the total volume base

    Returns:
        Total trade volume for this day
    """
    return self._total_volume_base

web_auction_fee_bps() property

Property for the web auction fee

Returns:

Type Description
int

Auction fee for all symbols in basis point for web orders

Source code in gemini_api/endpoints/fee_volume.py
181
182
183
184
185
186
187
188
189
@property
def web_auction_fee_bps(self) -> int:
    """
    Property for the web auction fee

    Returns:
        Auction fee for all symbols in basis point for web orders
    """
    return self._web_auction_fee_bps

web_maker_fee_bps() property

Property for the web maker fee

Returns:

Type Description
int

Maker fee for all symbols in basis point for web orders

Source code in gemini_api/endpoints/fee_volume.py
161
162
163
164
165
166
167
168
169
@property
def web_maker_fee_bps(self) -> int:
    """
    Property for the web maker fee

    Returns:
        Maker fee for all symbols in basis point for web orders
    """
    return self._web_maker_fee_bps

web_taker_fee_bps() property

Property for the web taker fee

Returns:

Type Description
int

Taker fee for all symbols in basis point for web orders

Source code in gemini_api/endpoints/fee_volume.py
171
172
173
174
175
176
177
178
179
@property
def web_taker_fee_bps(self) -> int:
    """
    Property for the web taker fee

    Returns:
        Taker fee for all symbols in basis point for web orders
    """
    return self._web_taker_fee_bps

FX Rate API

FXRate

Class for FX Rate historical reference

Source code in gemini_api/endpoints/fx_rate.py
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
class FXRate:
    """
    Class for FX Rate historical reference
    """

    __slots__ = [
        "_fx_pair",
        "_rate",
        "_as_of",
        "_provider",
        "_benchmark",
        "_result",
        "_message",
        "_reason",
    ]

    def __init__(
        self, auth: Authentication, fx_rate_data: Dict[str, Any]
    ) -> None:
        """
        Initialise FXRate class
        """
        if "fxPair" in fx_rate_data:
            self._fx_pair: str = fx_rate_data["fxPair"]
        if "rate" in fx_rate_data:
            self._rate: str = fx_rate_data["rate"]
        if "asOf" in fx_rate_data:
            self._as_of: int = fx_rate_data["asOf"]
        if "provider" in fx_rate_data:
            self._provider: str = fx_rate_data["provider"]
        if "benchmark" in fx_rate_data:
            self._benchmark: str = fx_rate_data["benchmark"]
        if "result" in fx_rate_data:
            self._result: str = fx_rate_data["result"]
        if "reason" in fx_rate_data:
            self._reason: str = fx_rate_data["reason"]
        if "message" in fx_rate_data:
            self._message: str = fx_rate_data["message"]

    @property
    def fx_pair(self) -> str:
        """
        Property for the requested currency pair

        Returns:
            Currency pair
        """
        return self._fx_pair

    @property
    def rate(self) -> str:
        """
        Property for the fx rate of the non USD currency. USD if the
        base currency and will always have a value of 1

        Returns:
            Rate
        """
        return self._rate

    @property
    def as_of(self) -> int:
        """
        Property for the timestamp that the requested fx rate has been
        retrieved for

        Returns:
            Timstamp in Epoch time format
        """
        return self._as_of

    @property
    def provider(self) -> str:
        """
        Property for the market data provider

        Returns:
            Market data provider
        """
        return self._provider

    @property
    def benchmark(self) -> str:
        """
        Property for the market for which the retrieved price applies to

        Returns:
            Market
        """
        return self._benchmark

    @property
    def result(self) -> str:
        """
        Property for the result upon errors or the state of a request

        Returns:
            Result
        """
        return self._result

    @property
    def reason(self) -> str:
        """
        Property for the reason of errors

        Returns:
            Short error description
        """
        return self._reason

    @property
    def message(self) -> str:
        """
        Property for the error message

        Returns:
            Error message description
        """
        return self._message

    @classmethod
    def get_fx_rate(
        cls, auth: Authentication, symbol: str, since: str
    ) -> FXRate:
        """
        Method to get the fx rate

        Timestamp is rounded to the closest timestamp received for an
        update from BCB

        Args:
            auth: Gemini authentication object
            symbol: Trading pair
            since: Date in YYYYMMDD format

        Returns:
            FXRate object
        """
        date_unix = date_to_unix_ts(since)
        path = f"/v2/fxrate/{symbol}/{date_unix}"

        res = auth.make_request(endpoint=path)
        return FXRate(auth=auth, fx_rate_data=res)

__init__(auth, fx_rate_data)

Initialise FXRate class

Source code in gemini_api/endpoints/fx_rate.py
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def __init__(
    self, auth: Authentication, fx_rate_data: Dict[str, Any]
) -> None:
    """
    Initialise FXRate class
    """
    if "fxPair" in fx_rate_data:
        self._fx_pair: str = fx_rate_data["fxPair"]
    if "rate" in fx_rate_data:
        self._rate: str = fx_rate_data["rate"]
    if "asOf" in fx_rate_data:
        self._as_of: int = fx_rate_data["asOf"]
    if "provider" in fx_rate_data:
        self._provider: str = fx_rate_data["provider"]
    if "benchmark" in fx_rate_data:
        self._benchmark: str = fx_rate_data["benchmark"]
    if "result" in fx_rate_data:
        self._result: str = fx_rate_data["result"]
    if "reason" in fx_rate_data:
        self._reason: str = fx_rate_data["reason"]
    if "message" in fx_rate_data:
        self._message: str = fx_rate_data["message"]

as_of() property

Property for the timestamp that the requested fx rate has been retrieved for

Returns:

Type Description
int

Timstamp in Epoch time format

Source code in gemini_api/endpoints/fx_rate.py
69
70
71
72
73
74
75
76
77
78
@property
def as_of(self) -> int:
    """
    Property for the timestamp that the requested fx rate has been
    retrieved for

    Returns:
        Timstamp in Epoch time format
    """
    return self._as_of

benchmark() property

Property for the market for which the retrieved price applies to

Returns:

Type Description
str

Market

Source code in gemini_api/endpoints/fx_rate.py
90
91
92
93
94
95
96
97
98
@property
def benchmark(self) -> str:
    """
    Property for the market for which the retrieved price applies to

    Returns:
        Market
    """
    return self._benchmark

fx_pair() property

Property for the requested currency pair

Returns:

Type Description
str

Currency pair

Source code in gemini_api/endpoints/fx_rate.py
48
49
50
51
52
53
54
55
56
@property
def fx_pair(self) -> str:
    """
    Property for the requested currency pair

    Returns:
        Currency pair
    """
    return self._fx_pair

get_fx_rate(auth, symbol, since) classmethod

Method to get the fx rate

Timestamp is rounded to the closest timestamp received for an update from BCB

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
symbol str

Trading pair

required
since str

Date in YYYYMMDD format

required

Returns:

Type Description
FXRate

FXRate object

Source code in gemini_api/endpoints/fx_rate.py
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
@classmethod
def get_fx_rate(
    cls, auth: Authentication, symbol: str, since: str
) -> FXRate:
    """
    Method to get the fx rate

    Timestamp is rounded to the closest timestamp received for an
    update from BCB

    Args:
        auth: Gemini authentication object
        symbol: Trading pair
        since: Date in YYYYMMDD format

    Returns:
        FXRate object
    """
    date_unix = date_to_unix_ts(since)
    path = f"/v2/fxrate/{symbol}/{date_unix}"

    res = auth.make_request(endpoint=path)
    return FXRate(auth=auth, fx_rate_data=res)

message() property

Property for the error message

Returns:

Type Description
str

Error message description

Source code in gemini_api/endpoints/fx_rate.py
120
121
122
123
124
125
126
127
128
@property
def message(self) -> str:
    """
    Property for the error message

    Returns:
        Error message description
    """
    return self._message

provider() property

Property for the market data provider

Returns:

Type Description
str

Market data provider

Source code in gemini_api/endpoints/fx_rate.py
80
81
82
83
84
85
86
87
88
@property
def provider(self) -> str:
    """
    Property for the market data provider

    Returns:
        Market data provider
    """
    return self._provider

rate() property

Property for the fx rate of the non USD currency. USD if the base currency and will always have a value of 1

Returns:

Type Description
str

Rate

Source code in gemini_api/endpoints/fx_rate.py
58
59
60
61
62
63
64
65
66
67
@property
def rate(self) -> str:
    """
    Property for the fx rate of the non USD currency. USD if the
    base currency and will always have a value of 1

    Returns:
        Rate
    """
    return self._rate

reason() property

Property for the reason of errors

Returns:

Type Description
str

Short error description

Source code in gemini_api/endpoints/fx_rate.py
110
111
112
113
114
115
116
117
118
@property
def reason(self) -> str:
    """
    Property for the reason of errors

    Returns:
        Short error description
    """
    return self._reason

result() property

Property for the result upon errors or the state of a request

Returns:

Type Description
str

Result

Source code in gemini_api/endpoints/fx_rate.py
100
101
102
103
104
105
106
107
108
@property
def result(self) -> str:
    """
    Property for the result upon errors or the state of a request

    Returns:
        Result
    """
    return self._result

Fund Management APIs

FundManagement

Class that manages Fund Management APIs

Source code in gemini_api/endpoints/fund_management.py
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
class FundManagement:
    """
    Class that manages Fund Management APIs
    """

    __slots__ = [
        "_currency",
        "_amount",
        "_available",
        "_available_for_withdrawal",
        "_type",
        "_amount_notional",
        "_available_notional",
        "_available_for_withdrawal_notional",
        "_status",
        "_timestampms",
        "_eid",
        "_advance_eid",
        "_fee_amount",
        "_fee_currency",
        "_method",
        "_tx_hash",
        "_outputidx",
        "_destination",
        "_purpose",
        "_tx_time",
        "_account_id",
        "_event_id" "_event_type",
        "_address",
        "_label",
        "_network",
        "_fee",
        "_withdrawal_id",
        "_message",
        "_is_override",
        "_monthly_limit",
        "_monthly_remaining",
        "_reference_id",
        "_result",
        "_reason",
        "_message",
        "_balances",
        "_banks",
    ]

    def __init__(
        self, auth: Authentication, fund_data: Union[Dict[str, Any], Any]
    ) -> None:
        """
        Initialise FundManagement class
        """
        if "currency" in fund_data:
            self._currency: str = fund_data["currency"]
        if "amount" in fund_data:
            self._amount: float = fund_data["amount"]
        if "available" in fund_data:
            self._available: float = fund_data["available"]
        if "availableForWithdrawal" in fund_data:
            self._available_for_withdrawal: float = fund_data[
                "availableForWithdrawal"
            ]
        if "type" in fund_data:
            self._type: str = fund_data["type"]
        if "amountNotional" in fund_data:
            self._amount_notional: float = fund_data["amountNotional"]
        if "availableNotional" in fund_data:
            self._available_notional: float = fund_data["availableNotional"]
        if "availableForWithdrawalNotional" in fund_data:
            self._available_for_withdrawal_notional: float = fund_data[
                "availableForWithdrawalNotional"
            ]
        if "status" in fund_data:
            self._status: str = fund_data["status"]
        if "timestampms" in fund_data:
            self._timestampms: int = fund_data["timestampms"]
        if "eid" in fund_data:
            self._eid: int = fund_data["eid"]
        if "advanceEid" in fund_data:
            self._advance_eid: int = fund_data["advanceEid"]
        if "feeAmount" in fund_data:
            self._fee_amount: int = fund_data["feeAmount"]
        if "feeCurrency" in fund_data:
            self._fee_currency: str = fund_data["feeCurrency"]
        if "method" in fund_data:
            self._method: str = fund_data["method"]
        if "txHash" in fund_data:
            self._tx_hash: str = fund_data["txHash"]
        if "outputIdx" in fund_data:
            self._outputidx: int = fund_data["outputidx"]
        if "destination" in fund_data:
            self._destination: str = fund_data["destination"]
        if "purpose" in fund_data:
            self._purpose: str = fund_data["purpose"]
        if "txTime" in fund_data:
            self._tx_time: str = fund_data["txTime"]
        if "accountId" in fund_data:
            self._account_id: int = fund_data["accountId"]
        if "eventId" in fund_data:
            self._event_id: int = fund_data["eventId"]
        if "eventType" in fund_data:
            self._event_type: str = fund_data["eventType"]
        if "address" in fund_data:
            self._address: str = fund_data["address"]
        if "label" in fund_data:
            self._label: str = fund_data["label"]
        if "network" in fund_data:
            self._network: str = fund_data["network"]
        if "fee" in fund_data:
            if isinstance(fund_data["fee"], dict):
                self._fee: Dict[str, str] = fund_data["fee"]["value"]
            else:
                self._fee = fund_data["fee"]
        if "withdrawalID" in fund_data:
            self._withdrawal_id: str = fund_data["withdrawalID"]
        if "isOverride" in fund_data:
            self._is_override: bool = fund_data["is_override"]
        if "monthlyLimit" in fund_data:
            self._monthly_limit: int = fund_data["monthly_limit"]
        if "montlyRemaining" in fund_data:
            self._monthly_remaining: int = fund_data["montly_remaining"]
        if "referenceId" in fund_data:
            self._reference_id: str = fund_data["reference_id"]
        if "balances" in fund_data:
            self._balances: List[Dict[str, str]] = fund_data["balances"]
        if "banks" in fund_data:
            self._banks: List[Dict[str, str]] = fund_data["banks"]
        if "result" in fund_data:
            self._result: str = fund_data["result"]
        if "reason" in fund_data:
            self._reason: str = fund_data["reason"]
        if "message" in fund_data:
            self._message: str = fund_data["message"]

    @property
    def currency(self) -> str:
        """
        Property for the currency code

        Returns:
            Currency code
        """
        return self._currency

    @property
    def amount(self) -> float:
        """
        Property for the current balance or transfer amount

        Returns:
            Current balance or transfer amount
        """
        return self._amount

    @property
    def available(self) -> float:
        """
        Property for the amount that is available to trade

        Returns:
            Amount available to trade
        """
        return self._available

    @property
    def available_for_withdrawal(self) -> float:
        """
        Property for the amount that is available to withdraw

        Returns:
            Amount available to withdraw
        """
        return self._available_for_withdrawal

    @property
    def account_transfer_type(self) -> str:
        """
        Property for the type of account (always "exchange") or the
        transfer type (either "Deposit" or "Withdrawal")

        Returns:
            Type of account or transfer
        """
        return self._type

    @property
    def amount_notional(self) -> float:
        """
        Property for the amount in notional

        Returns:
            Notional amount
        """
        return self._amount_notional

    @property
    def available_notional(self) -> float:
        """
        Property for the amount available to trade in notional

        Returns:
            Amount available in notional
        """
        return self._available_notional

    @property
    def available_for_withdrawal_notional(self) -> float:
        """
        Property for the amount available to withdraw in notional

        Returns:
            Amount available to withdraw in notional
        """
        return self._available_for_withdrawal_notional

    @property
    def status(self) -> str:
        """
        Property for the transfer status which is either 'Advanced' or
        'Complete'

        Returns:
            Status
        """
        return self._status

    @property
    def timestampms(self) -> int:
        """
        Property for the time of the transfer in milliseconds or the
        creation of the cryptocurrency address

        Returns:
            Number of milliseconds since 1970-01-01 UTC
        """
        return self._timestampms

    @property
    def eid(self) -> int:
        """
        Property for the transfer event id

        Returns:
            Transfer event id
        """
        return self._eid

    @property
    def advance_eid(self) -> int:
        """
        Property for the deposit advance event id

        Returns:
            Deposit advance event id
        """
        return self._advance_eid

    @property
    def fee_amount(self) -> float:
        """
        Property for the fee amount charged

        Returns:
            Fee amount
        """
        return self._fee_amount

    @property
    def fee_currency(self) -> str:
        """
        Property for the fee currency

        Returns:
            Currency the fee was paid in
        """
        return self._fee_currency

    @property
    def method(self) -> str:
        """
        Property for the transfer - if fiat currency, the method field
        will attempty to supply "ACH", "WIRE" or "SEN". If the transfer
        is internal, the method field will return "Internal"

        Returns:
            Transfer method
        """
        return self._method

    @property
    def tx_hash(self) -> str:
        """
        Property for the transaction hash for when the currency is a
        cryptocurrency - only shown for ETH and GUSD for withdrawals

        Returns:
            Transaction hash
        """
        return self._tx_hash

    @property
    def outputidx(self) -> int:
        """
        Property for the output index for transactions for when the
        currency is a cryptocurrency

        Returns:
            Output index
        """
        return self._outputidx

    @property
    def destination(self) -> str:
        """
        Property for the destination address for when the currency is
        a cryptocurrency

        Returns:
            Destination address
        """
        return self._destination

    @property
    def purpose(self) -> str:
        """
        Property for the administrative field to supply a reason for
        certain types of advances

        Returns:
            Purpose
        """
        return self._purpose

    @property
    def tx_time(self) -> str:
        """
        Property for the time of custody fee record

        Returns:
            Time of custody fee record
        """
        return self._tx_time

    @property
    def account_id(self) -> int:
        """
        Property for the custody account id

        Returns:
            Account id
        """
        return self._account_id

    @property
    def event_id(self) -> int:
        """
        Property for the custody fee event id

        Returns:
            Event id
        """
        return self._event_id

    @property
    def event_type(self) -> str:
        """
        Property for the custody fee event type

        Returns:
            Event type
        """
        return self._event_type

    @property
    def address(self) -> str:
        """
        Property for the new cryptocurrency address

        Returns:
            Cryptocurrency address
        """
        return self._address

    @property
    def label(self) -> str:
        """
        Property for the label if provided upon creation of the
        cryptocurrency address

        Returns:
            address
        """
        return self._label

    @property
    def network(self) -> str:
        """
        Property for the network

        Returns:
            address
        """
        return self._network

    @property
    def fee(self) -> Union[Dict[str, str], str]:
        """
        Property for the fee in kind applied to the transaction or
        the estimated gas fee for withdrawals

        Returns:
            Withdrawal fee or gas estimation fee
        """
        return self._fee

    @property
    def withdrawal_id(self) -> str:
        """
        Property for the withdrawal id - only shown for BTC, ZEC, LTC
        and BCH withdrawals

        Returns:
            Unique withdrawal id
        """
        return self._withdrawal_id

    @property
    def message(self) -> str:
        """
        Property for the human-readable English message describing
        the withdrawal - only shown for BTC, ZEC, LTC and BCH withdrawals.
        Also can be the error message description for failed requests.

        Returns:
            Message
        """
        return self._message

    @property
    def is_override(self) -> bool:
        """
        Property for the value that shows if an override on the
        customer's account for free withdrawals exists

        Returns:
            True if override exists, False otherwise
        """
        return self._is_override

    @property
    def monthly_limit(self) -> int:
        """
        Property for the total number of allowable fee-free withdrawals

        Returns:
            Number of fee-free withdrawals
        """
        return self._monthly_limit

    @property
    def montly_remaining(self) -> int:
        """
        Property for the total number of allowable fee-free withdrawals
        left to use

        Returns:
            Number of fee-free withdrawals left to use
        """
        return self._monthly_remaining

    @property
    def reference_id(self) -> str:
        """
        Property for the reference id for the new bank addition request

        Returns:
            Reference id
        """
        return self._reference_id

    @property
    def result(self) -> str:
        """
        Property for the result upon errors or the state of a request

        Returns:
            Result
        """
        return self._result

    @property
    def reason(self) -> str:
        """
        Property for the reason of errors

        Returns:
            Short error description
        """
        return self._reason

    @property
    def balances(self) -> List[Dict[str, str]]:
        """
        Property for the balance information of available fiat payment
        methods containing details on the account type (always "exchange"),
        currency, amount, available amount for trading and available
        amount for withdrawal

        Returns:
            List of balances dictionaries
        """
        return self._balances

    @property
    def banks(self) -> List[Dict[str, str]]:
        """
        Property for the bank information containing details on bank
        name and id

        Returns:
            List of bank dictionaries
        """
        return self._banks

    @classmethod
    def get_available_balances(
        cls, auth: Authentication
    ) -> List[FundManagement]:

        """
        Method to get available balances in the supported currencies

        Args:
            auth: Gemini authentication object

        Returns:
            List of FundManagement object
        """
        path = "/v1/balances"

        res = auth.make_request(endpoint=path)

        all_available_balances = []

        for i in range(len(res)):
            balance = FundManagement(auth=auth, fund_data=res[i])
            all_available_balances.append(balance)

        return all_available_balances

    @classmethod
    def get_notional_balances(
        cls, auth: Authentication, currency: str
    ) -> List[FundManagement]:

        """
        Method to get available balances in the supported currencies
        as well as the notional value in the currency specified

        Args:
            auth: Gemini authentication object
            currency: supported three-letter fiat currency code


        Returns:
            List of FundManagement object
        """
        path = f"/v1/notionalbalances/{currency}"

        res = auth.make_request(endpoint=path)

        all_notional_balances = []

        for i in range(len(res)):
            balance = FundManagement(auth=auth, fund_data=res[i])
            all_notional_balances.append(balance)

        return all_notional_balances

    @classmethod
    def get_transfers(
        cls,
        auth: Authentication,
        since: str = None,
        show_completed_deposit_advances: bool = None,
        limit_transfers: int = None,
        currency: str = None,
    ) -> List[FundManagement]:

        """
        Method to get transfers - shows deposits and withdrawals in the
        supported currencies. When deposits show as Advanced or Complete
        status, they are available for trading.

        This method does not currently show cancelled advances,
        returned outgoing wires or ACH transactions,
        or other exceptional transaction circumstances.

        Args:
            auth: Gemini authentication object
            since: Date in YYYYMMDD format
            show_completed_deposit_advances: Display completed deposit advances
            limit_transfers: The maximum number of transfers to return
            currency: Currency code symbols

        Returns:
            List of FundManagement object
        """
        path = "/v1/transfers"

        data: Dict[str, Any] = {}

        if since is not None:
            data["timestamp"] = date_to_unix_ts(since)
        if currency is not None:
            data["currency"] = currency
        if limit_transfers is not None:
            data["limit_transfers"] = limit_transfers
        if show_completed_deposit_advances is not None:
            data[
                "show_completed_deposit_advances"
            ] = show_completed_deposit_advances

        res = auth.make_request(endpoint=path, payload=data)

        all_transfers = []

        for i in range(len(res)):
            transfer = FundManagement(auth=auth, fund_data=res[i])
            all_transfers.append(transfer)

        return all_transfers

    @classmethod
    def get_custody_fees(
        cls,
        auth: Authentication,
        since: str = None,
        limit_transfers: int = None,
    ) -> List[FundManagement]:

        """
        Method to get Custody fee records in the supported currencies

        Args:
            auth: Gemini authentication object
            since: Date in YYYYMMDD format
            limit_transfers: The maximum nmber of transfers to return

        Returns:
            List of FundManagement object
        """
        path = "/v1/custodyaccountfees"

        data = {}

        if since is not None:
            data["timestamp"] = date_to_unix_ts(since)
        if limit_transfers is not None:
            data["limit_transfers"] = limit_transfers

        res = auth.make_request(endpoint=path, payload=data)

        all_custody_fees = []

        for i in range(len(res)):
            custody_fee = FundManagement(auth=auth, fund_data=res[i])
            all_custody_fees.append(custody_fee)

        return all_custody_fees

    @classmethod
    def get_deposit_address(
        cls, auth: Authentication, network: str, since: str = None
    ) -> List[FundManagement]:

        """
        Method to get deposit address

        The network can be bitcoin, ethereum, bitcoincash, litecoin,
        zcash, filecoin, dogecoin, tezos, or solana

        Args:
            auth: Gemini API authentication object
            network: e.g. bitcoin
            since: Date in YYYYMMDD format

        Returns:
            List of FundManagement object
        """
        path = f"/v1/addresses/{network}"

        data = {}

        if since is not None:
            data["timestamp"] = date_to_unix_ts(since)

        res = auth.make_request(endpoint=path, payload=data)

        all_deposit_addresses = []

        for i in range(len(res)):
            deposit_address = FundManagement(auth=auth, fund_data=res[i])
            all_deposit_addresses.append(deposit_address)

        return all_deposit_addresses

    @classmethod
    def create_new_deposit_address(
        cls,
        auth: Authentication,
        network: str,
        label: str = None,
        since: str = None,
        legacy: bool = False,
    ) -> FundManagement:

        """
        Method to get custody fee records

        The network can be bitcoin, ethereum, bitcoincash, litecoin,
        zcash, filecoin, dogecoin, tezos, or solana

        Args:
            auth: Gemini authentication object
            network: e.g. bitcoin
            label: The label for the new address if provided on creation
            since: Date in YYYYMMDD format
            legacy: Whether to generate a legacy P2SH-P2PKH litecoin address

        Returns:
            Fundmanagement object
        """
        path = f"/v1/deposit/{network}/newAddress"

        data: Dict[str, Any] = {}

        if since is not None:
            data["timestamp"] = date_to_unix_ts(since)
        if label is not None:
            data["label"] = label
        if legacy is not None:
            data["legacy"] = legacy

        res = auth.make_request(endpoint=path, payload=data)

        return FundManagement(auth=auth, fund_data=res)

    @classmethod
    def withdraw_crypto(
        cls,
        auth: Authentication,
        currency: str,
        address: str,
        amount: str,
        client_transfer_id: str = None,
    ) -> FundManagement:

        """
        Method to withdraw crypto funds

        Args:
            auth: Gemini authentication object
            currency: Currency code symbols
            address: Standard string format of cryptocurrency address
            amount: Quoted decimal amount to withdraw
            client_transfer_id: Unique identifier for withdrawal, uuid4 format

        Returns:
            FundManagement object
        """
        path = f"/v1/withdraw/{currency}"

        data = {
            "address": address,
            "amount": amount,
        }

        if client_transfer_id is not None:
            data["client_transfer_id"] = client_transfer_id

        res = auth.make_request(endpoint=path, payload=data)

        return FundManagement(auth=auth, fund_data=res)

    @classmethod
    def gas_fee_estimation(
        cls,
        auth: Authentication,
        address: str,
        amount: str,
        currency: str,
        account: List[str] = ["primary"],
    ) -> FundManagement:

        """
        Method to estimate gas fees for ETH and ERC20 tokens

        Args:
            auth: Gemini authentication object
            address: Standard string format of cryptocurrency address
            amount: Quoted decimal amount to withdraw
            currency: Currency code of a supported crypto-currency, e.g. eth
            account: The name of the account within the subaccount group

        Returns:
            FundManagement object
        """
        path = f"/v1/withdraw/{currency}/feeEstimate"

        data = {"address": address, "amount": amount, "account": account}

        res = auth.make_request(endpoint=path, payload=data)

        return FundManagement(auth=auth, fund_data=res)

    @classmethod
    def add_us_bank(
        cls,
        auth: Authentication,
        accountnumber: str,
        routing: str,
        type: str,
        name: str,
    ) -> FundManagement:

        """
        Method to add a US bank

        Args:
            auth: Gemini authentication object
            accountnumber: Account number of bank account to be added
            routing: Routing number of bank account to be added
            type: Type of bank account to be added
            name: Name of the bank account as shown on your account statements


        Returns:
            FundManagement object
        """
        path = "/v1/payments/addbank"

        data = {
            "accountnumber": accountnumber,
            "routing": routing,
            "type": type,
            "name": name,
        }

        res = auth.make_request(endpoint=path, payload=data)

        return FundManagement(auth=auth, fund_data=res)

    @classmethod
    def add_cad_bank(
        cls,
        auth: Authentication,
        swiftcode: str,
        accountnumber: str,
        type: str,
        name: str,
        institutionnumber: str = None,
        branchnumber: str = None,
    ) -> FundManagement:

        """
        Method to add a CAD bank

        Args:
            auth: Gemini authentication object
            swiftcode: The account SWIFT code
            accountnumber: Account number of bank account to be added
            type: Type of bank account to be added
            institutionnumber: the institution number of the account
            branchnumber: The branch number

        Returns:
            FundManagement object
        """
        path = "/v1/payments/addbank"

        data = {
            "accountnumber": accountnumber,
            "swiftcode": swiftcode,
            "type": type,
            "name": name,
        }

        if institutionnumber is not None:
            data["institutionnumber"] = institutionnumber
        if branchnumber is not None:
            data["branchnumber"] = branchnumber

        res = auth.make_request(endpoint=path, payload=data)

        return FundManagement(auth=auth, fund_data=res)

    @classmethod
    def get_payment_methods(
        cls,
        auth: Authentication,
    ) -> FundManagement:

        """
        Method to get data on balances in the account and linked banks

        Args:
            auth: Gemini authentication object

        Returns:
            FundManagement object
        """
        path = "/v1/payments/methods"

        res = auth.make_request(endpoint=path)

        return FundManagement(auth=auth, fund_data=res)

    @classmethod
    def sen_withdrawal(
        cls, auth: Authentication, bankId: str, amount: float
    ) -> FundManagement:

        """
        Method to withdraw USD via SEN

        Args:
            auth: Gemini authentication object
            bankId: Unique ID for your SEN bank account
            amount: Amount (USD) to transfer to your account

        Returns:
            FundManagement object
        """
        path = "/v1/payments/sen/withdraw"

        res = auth.make_request(endpoint=path)

        return FundManagement(auth=auth, fund_data=res)

__init__(auth, fund_data)

Initialise FundManagement class

Source code in gemini_api/endpoints/fund_management.py
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
def __init__(
    self, auth: Authentication, fund_data: Union[Dict[str, Any], Any]
) -> None:
    """
    Initialise FundManagement class
    """
    if "currency" in fund_data:
        self._currency: str = fund_data["currency"]
    if "amount" in fund_data:
        self._amount: float = fund_data["amount"]
    if "available" in fund_data:
        self._available: float = fund_data["available"]
    if "availableForWithdrawal" in fund_data:
        self._available_for_withdrawal: float = fund_data[
            "availableForWithdrawal"
        ]
    if "type" in fund_data:
        self._type: str = fund_data["type"]
    if "amountNotional" in fund_data:
        self._amount_notional: float = fund_data["amountNotional"]
    if "availableNotional" in fund_data:
        self._available_notional: float = fund_data["availableNotional"]
    if "availableForWithdrawalNotional" in fund_data:
        self._available_for_withdrawal_notional: float = fund_data[
            "availableForWithdrawalNotional"
        ]
    if "status" in fund_data:
        self._status: str = fund_data["status"]
    if "timestampms" in fund_data:
        self._timestampms: int = fund_data["timestampms"]
    if "eid" in fund_data:
        self._eid: int = fund_data["eid"]
    if "advanceEid" in fund_data:
        self._advance_eid: int = fund_data["advanceEid"]
    if "feeAmount" in fund_data:
        self._fee_amount: int = fund_data["feeAmount"]
    if "feeCurrency" in fund_data:
        self._fee_currency: str = fund_data["feeCurrency"]
    if "method" in fund_data:
        self._method: str = fund_data["method"]
    if "txHash" in fund_data:
        self._tx_hash: str = fund_data["txHash"]
    if "outputIdx" in fund_data:
        self._outputidx: int = fund_data["outputidx"]
    if "destination" in fund_data:
        self._destination: str = fund_data["destination"]
    if "purpose" in fund_data:
        self._purpose: str = fund_data["purpose"]
    if "txTime" in fund_data:
        self._tx_time: str = fund_data["txTime"]
    if "accountId" in fund_data:
        self._account_id: int = fund_data["accountId"]
    if "eventId" in fund_data:
        self._event_id: int = fund_data["eventId"]
    if "eventType" in fund_data:
        self._event_type: str = fund_data["eventType"]
    if "address" in fund_data:
        self._address: str = fund_data["address"]
    if "label" in fund_data:
        self._label: str = fund_data["label"]
    if "network" in fund_data:
        self._network: str = fund_data["network"]
    if "fee" in fund_data:
        if isinstance(fund_data["fee"], dict):
            self._fee: Dict[str, str] = fund_data["fee"]["value"]
        else:
            self._fee = fund_data["fee"]
    if "withdrawalID" in fund_data:
        self._withdrawal_id: str = fund_data["withdrawalID"]
    if "isOverride" in fund_data:
        self._is_override: bool = fund_data["is_override"]
    if "monthlyLimit" in fund_data:
        self._monthly_limit: int = fund_data["monthly_limit"]
    if "montlyRemaining" in fund_data:
        self._monthly_remaining: int = fund_data["montly_remaining"]
    if "referenceId" in fund_data:
        self._reference_id: str = fund_data["reference_id"]
    if "balances" in fund_data:
        self._balances: List[Dict[str, str]] = fund_data["balances"]
    if "banks" in fund_data:
        self._banks: List[Dict[str, str]] = fund_data["banks"]
    if "result" in fund_data:
        self._result: str = fund_data["result"]
    if "reason" in fund_data:
        self._reason: str = fund_data["reason"]
    if "message" in fund_data:
        self._message: str = fund_data["message"]

account_id() property

Property for the custody account id

Returns:

Type Description
int

Account id

Source code in gemini_api/endpoints/fund_management.py
351
352
353
354
355
356
357
358
359
@property
def account_id(self) -> int:
    """
    Property for the custody account id

    Returns:
        Account id
    """
    return self._account_id

account_transfer_type() property

Property for the type of account (always "exchange") or the transfer type (either "Deposit" or "Withdrawal")

Returns:

Type Description
str

Type of account or transfer

Source code in gemini_api/endpoints/fund_management.py
182
183
184
185
186
187
188
189
190
191
@property
def account_transfer_type(self) -> str:
    """
    Property for the type of account (always "exchange") or the
    transfer type (either "Deposit" or "Withdrawal")

    Returns:
        Type of account or transfer
    """
    return self._type

add_cad_bank(auth, swiftcode, accountnumber, type, name, institutionnumber=None, branchnumber=None) classmethod

Method to add a CAD bank

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
swiftcode str

The account SWIFT code

required
accountnumber str

Account number of bank account to be added

required
type str

Type of bank account to be added

required
institutionnumber str

the institution number of the account

None
branchnumber str

The branch number

None

Returns:

Type Description
FundManagement

FundManagement object

Source code in gemini_api/endpoints/fund_management.py
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
@classmethod
def add_cad_bank(
    cls,
    auth: Authentication,
    swiftcode: str,
    accountnumber: str,
    type: str,
    name: str,
    institutionnumber: str = None,
    branchnumber: str = None,
) -> FundManagement:

    """
    Method to add a CAD bank

    Args:
        auth: Gemini authentication object
        swiftcode: The account SWIFT code
        accountnumber: Account number of bank account to be added
        type: Type of bank account to be added
        institutionnumber: the institution number of the account
        branchnumber: The branch number

    Returns:
        FundManagement object
    """
    path = "/v1/payments/addbank"

    data = {
        "accountnumber": accountnumber,
        "swiftcode": swiftcode,
        "type": type,
        "name": name,
    }

    if institutionnumber is not None:
        data["institutionnumber"] = institutionnumber
    if branchnumber is not None:
        data["branchnumber"] = branchnumber

    res = auth.make_request(endpoint=path, payload=data)

    return FundManagement(auth=auth, fund_data=res)

add_us_bank(auth, accountnumber, routing, type, name) classmethod

Method to add a US bank

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
accountnumber str

Account number of bank account to be added

required
routing str

Routing number of bank account to be added

required
type str

Type of bank account to be added

required
name str

Name of the bank account as shown on your account statements

required

Returns:

Type Description
FundManagement

FundManagement object

Source code in gemini_api/endpoints/fund_management.py
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
@classmethod
def add_us_bank(
    cls,
    auth: Authentication,
    accountnumber: str,
    routing: str,
    type: str,
    name: str,
) -> FundManagement:

    """
    Method to add a US bank

    Args:
        auth: Gemini authentication object
        accountnumber: Account number of bank account to be added
        routing: Routing number of bank account to be added
        type: Type of bank account to be added
        name: Name of the bank account as shown on your account statements


    Returns:
        FundManagement object
    """
    path = "/v1/payments/addbank"

    data = {
        "accountnumber": accountnumber,
        "routing": routing,
        "type": type,
        "name": name,
    }

    res = auth.make_request(endpoint=path, payload=data)

    return FundManagement(auth=auth, fund_data=res)

address() property

Property for the new cryptocurrency address

Returns:

Type Description
str

Cryptocurrency address

Source code in gemini_api/endpoints/fund_management.py
381
382
383
384
385
386
387
388
389
@property
def address(self) -> str:
    """
    Property for the new cryptocurrency address

    Returns:
        Cryptocurrency address
    """
    return self._address

advance_eid() property

Property for the deposit advance event id

Returns:

Type Description
int

Deposit advance event id

Source code in gemini_api/endpoints/fund_management.py
255
256
257
258
259
260
261
262
263
@property
def advance_eid(self) -> int:
    """
    Property for the deposit advance event id

    Returns:
        Deposit advance event id
    """
    return self._advance_eid

amount() property

Property for the current balance or transfer amount

Returns:

Type Description
float

Current balance or transfer amount

Source code in gemini_api/endpoints/fund_management.py
152
153
154
155
156
157
158
159
160
@property
def amount(self) -> float:
    """
    Property for the current balance or transfer amount

    Returns:
        Current balance or transfer amount
    """
    return self._amount

amount_notional() property

Property for the amount in notional

Returns:

Type Description
float

Notional amount

Source code in gemini_api/endpoints/fund_management.py
193
194
195
196
197
198
199
200
201
@property
def amount_notional(self) -> float:
    """
    Property for the amount in notional

    Returns:
        Notional amount
    """
    return self._amount_notional

available() property

Property for the amount that is available to trade

Returns:

Type Description
float

Amount available to trade

Source code in gemini_api/endpoints/fund_management.py
162
163
164
165
166
167
168
169
170
@property
def available(self) -> float:
    """
    Property for the amount that is available to trade

    Returns:
        Amount available to trade
    """
    return self._available

available_for_withdrawal() property

Property for the amount that is available to withdraw

Returns:

Type Description
float

Amount available to withdraw

Source code in gemini_api/endpoints/fund_management.py
172
173
174
175
176
177
178
179
180
@property
def available_for_withdrawal(self) -> float:
    """
    Property for the amount that is available to withdraw

    Returns:
        Amount available to withdraw
    """
    return self._available_for_withdrawal

available_for_withdrawal_notional() property

Property for the amount available to withdraw in notional

Returns:

Type Description
float

Amount available to withdraw in notional

Source code in gemini_api/endpoints/fund_management.py
213
214
215
216
217
218
219
220
221
@property
def available_for_withdrawal_notional(self) -> float:
    """
    Property for the amount available to withdraw in notional

    Returns:
        Amount available to withdraw in notional
    """
    return self._available_for_withdrawal_notional

available_notional() property

Property for the amount available to trade in notional

Returns:

Type Description
float

Amount available in notional

Source code in gemini_api/endpoints/fund_management.py
203
204
205
206
207
208
209
210
211
@property
def available_notional(self) -> float:
    """
    Property for the amount available to trade in notional

    Returns:
        Amount available in notional
    """
    return self._available_notional

balances() property

Property for the balance information of available fiat payment methods containing details on the account type (always "exchange"), currency, amount, available amount for trading and available amount for withdrawal

Returns:

Type Description
List[Dict[str, str]]

List of balances dictionaries

Source code in gemini_api/endpoints/fund_management.py
508
509
510
511
512
513
514
515
516
517
518
519
@property
def balances(self) -> List[Dict[str, str]]:
    """
    Property for the balance information of available fiat payment
    methods containing details on the account type (always "exchange"),
    currency, amount, available amount for trading and available
    amount for withdrawal

    Returns:
        List of balances dictionaries
    """
    return self._balances

banks() property

Property for the bank information containing details on bank name and id

Returns:

Type Description
List[Dict[str, str]]

List of bank dictionaries

Source code in gemini_api/endpoints/fund_management.py
521
522
523
524
525
526
527
528
529
530
@property
def banks(self) -> List[Dict[str, str]]:
    """
    Property for the bank information containing details on bank
    name and id

    Returns:
        List of bank dictionaries
    """
    return self._banks

create_new_deposit_address(auth, network, label=None, since=None, legacy=False) classmethod

Method to get custody fee records

The network can be bitcoin, ethereum, bitcoincash, litecoin, zcash, filecoin, dogecoin, tezos, or solana

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
network str

e.g. bitcoin

required
label str

The label for the new address if provided on creation

None
since str

Date in YYYYMMDD format

None
legacy bool

Whether to generate a legacy P2SH-P2PKH litecoin address

False

Returns:

Type Description
FundManagement

Fundmanagement object

Source code in gemini_api/endpoints/fund_management.py
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
@classmethod
def create_new_deposit_address(
    cls,
    auth: Authentication,
    network: str,
    label: str = None,
    since: str = None,
    legacy: bool = False,
) -> FundManagement:

    """
    Method to get custody fee records

    The network can be bitcoin, ethereum, bitcoincash, litecoin,
    zcash, filecoin, dogecoin, tezos, or solana

    Args:
        auth: Gemini authentication object
        network: e.g. bitcoin
        label: The label for the new address if provided on creation
        since: Date in YYYYMMDD format
        legacy: Whether to generate a legacy P2SH-P2PKH litecoin address

    Returns:
        Fundmanagement object
    """
    path = f"/v1/deposit/{network}/newAddress"

    data: Dict[str, Any] = {}

    if since is not None:
        data["timestamp"] = date_to_unix_ts(since)
    if label is not None:
        data["label"] = label
    if legacy is not None:
        data["legacy"] = legacy

    res = auth.make_request(endpoint=path, payload=data)

    return FundManagement(auth=auth, fund_data=res)

currency() property

Property for the currency code

Returns:

Type Description
str

Currency code

Source code in gemini_api/endpoints/fund_management.py
142
143
144
145
146
147
148
149
150
@property
def currency(self) -> str:
    """
    Property for the currency code

    Returns:
        Currency code
    """
    return self._currency

destination() property

Property for the destination address for when the currency is a cryptocurrency

Returns:

Type Description
str

Destination address

Source code in gemini_api/endpoints/fund_management.py
319
320
321
322
323
324
325
326
327
328
@property
def destination(self) -> str:
    """
    Property for the destination address for when the currency is
    a cryptocurrency

    Returns:
        Destination address
    """
    return self._destination

eid() property

Property for the transfer event id

Returns:

Type Description
int

Transfer event id

Source code in gemini_api/endpoints/fund_management.py
245
246
247
248
249
250
251
252
253
@property
def eid(self) -> int:
    """
    Property for the transfer event id

    Returns:
        Transfer event id
    """
    return self._eid

event_id() property

Property for the custody fee event id

Returns:

Type Description
int

Event id

Source code in gemini_api/endpoints/fund_management.py
361
362
363
364
365
366
367
368
369
@property
def event_id(self) -> int:
    """
    Property for the custody fee event id

    Returns:
        Event id
    """
    return self._event_id

event_type() property

Property for the custody fee event type

Returns:

Type Description
str

Event type

Source code in gemini_api/endpoints/fund_management.py
371
372
373
374
375
376
377
378
379
@property
def event_type(self) -> str:
    """
    Property for the custody fee event type

    Returns:
        Event type
    """
    return self._event_type

fee() property

Property for the fee in kind applied to the transaction or the estimated gas fee for withdrawals

Returns:

Type Description
Union[Dict[str, str], str]

Withdrawal fee or gas estimation fee

Source code in gemini_api/endpoints/fund_management.py
412
413
414
415
416
417
418
419
420
421
@property
def fee(self) -> Union[Dict[str, str], str]:
    """
    Property for the fee in kind applied to the transaction or
    the estimated gas fee for withdrawals

    Returns:
        Withdrawal fee or gas estimation fee
    """
    return self._fee

fee_amount() property

Property for the fee amount charged

Returns:

Type Description
float

Fee amount

Source code in gemini_api/endpoints/fund_management.py
265
266
267
268
269
270
271
272
273
@property
def fee_amount(self) -> float:
    """
    Property for the fee amount charged

    Returns:
        Fee amount
    """
    return self._fee_amount

fee_currency() property

Property for the fee currency

Returns:

Type Description
str

Currency the fee was paid in

Source code in gemini_api/endpoints/fund_management.py
275
276
277
278
279
280
281
282
283
@property
def fee_currency(self) -> str:
    """
    Property for the fee currency

    Returns:
        Currency the fee was paid in
    """
    return self._fee_currency

gas_fee_estimation(auth, address, amount, currency, account=['primary']) classmethod

Method to estimate gas fees for ETH and ERC20 tokens

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
address str

Standard string format of cryptocurrency address

required
amount str

Quoted decimal amount to withdraw

required
currency str

Currency code of a supported crypto-currency, e.g. eth

required
account List[str]

The name of the account within the subaccount group

['primary']

Returns:

Type Description
FundManagement

FundManagement object

Source code in gemini_api/endpoints/fund_management.py
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
@classmethod
def gas_fee_estimation(
    cls,
    auth: Authentication,
    address: str,
    amount: str,
    currency: str,
    account: List[str] = ["primary"],
) -> FundManagement:

    """
    Method to estimate gas fees for ETH and ERC20 tokens

    Args:
        auth: Gemini authentication object
        address: Standard string format of cryptocurrency address
        amount: Quoted decimal amount to withdraw
        currency: Currency code of a supported crypto-currency, e.g. eth
        account: The name of the account within the subaccount group

    Returns:
        FundManagement object
    """
    path = f"/v1/withdraw/{currency}/feeEstimate"

    data = {"address": address, "amount": amount, "account": account}

    res = auth.make_request(endpoint=path, payload=data)

    return FundManagement(auth=auth, fund_data=res)

get_available_balances(auth) classmethod

Method to get available balances in the supported currencies

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required

Returns:

Type Description
List[FundManagement]

List of FundManagement object

Source code in gemini_api/endpoints/fund_management.py
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
@classmethod
def get_available_balances(
    cls, auth: Authentication
) -> List[FundManagement]:

    """
    Method to get available balances in the supported currencies

    Args:
        auth: Gemini authentication object

    Returns:
        List of FundManagement object
    """
    path = "/v1/balances"

    res = auth.make_request(endpoint=path)

    all_available_balances = []

    for i in range(len(res)):
        balance = FundManagement(auth=auth, fund_data=res[i])
        all_available_balances.append(balance)

    return all_available_balances

get_custody_fees(auth, since=None, limit_transfers=None) classmethod

Method to get Custody fee records in the supported currencies

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
since str

Date in YYYYMMDD format

None
limit_transfers int

The maximum nmber of transfers to return

None

Returns:

Type Description
List[FundManagement]

List of FundManagement object

Source code in gemini_api/endpoints/fund_management.py
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
@classmethod
def get_custody_fees(
    cls,
    auth: Authentication,
    since: str = None,
    limit_transfers: int = None,
) -> List[FundManagement]:

    """
    Method to get Custody fee records in the supported currencies

    Args:
        auth: Gemini authentication object
        since: Date in YYYYMMDD format
        limit_transfers: The maximum nmber of transfers to return

    Returns:
        List of FundManagement object
    """
    path = "/v1/custodyaccountfees"

    data = {}

    if since is not None:
        data["timestamp"] = date_to_unix_ts(since)
    if limit_transfers is not None:
        data["limit_transfers"] = limit_transfers

    res = auth.make_request(endpoint=path, payload=data)

    all_custody_fees = []

    for i in range(len(res)):
        custody_fee = FundManagement(auth=auth, fund_data=res[i])
        all_custody_fees.append(custody_fee)

    return all_custody_fees

get_deposit_address(auth, network, since=None) classmethod

Method to get deposit address

The network can be bitcoin, ethereum, bitcoincash, litecoin, zcash, filecoin, dogecoin, tezos, or solana

Parameters:

Name Type Description Default
auth Authentication

Gemini API authentication object

required
network str

e.g. bitcoin

required
since str

Date in YYYYMMDD format

None

Returns:

Type Description
List[FundManagement]

List of FundManagement object

Source code in gemini_api/endpoints/fund_management.py
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
@classmethod
def get_deposit_address(
    cls, auth: Authentication, network: str, since: str = None
) -> List[FundManagement]:

    """
    Method to get deposit address

    The network can be bitcoin, ethereum, bitcoincash, litecoin,
    zcash, filecoin, dogecoin, tezos, or solana

    Args:
        auth: Gemini API authentication object
        network: e.g. bitcoin
        since: Date in YYYYMMDD format

    Returns:
        List of FundManagement object
    """
    path = f"/v1/addresses/{network}"

    data = {}

    if since is not None:
        data["timestamp"] = date_to_unix_ts(since)

    res = auth.make_request(endpoint=path, payload=data)

    all_deposit_addresses = []

    for i in range(len(res)):
        deposit_address = FundManagement(auth=auth, fund_data=res[i])
        all_deposit_addresses.append(deposit_address)

    return all_deposit_addresses

get_notional_balances(auth, currency) classmethod

Method to get available balances in the supported currencies as well as the notional value in the currency specified

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
currency str

supported three-letter fiat currency code

required

Returns:

Type Description
List[FundManagement]

List of FundManagement object

Source code in gemini_api/endpoints/fund_management.py
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
@classmethod
def get_notional_balances(
    cls, auth: Authentication, currency: str
) -> List[FundManagement]:

    """
    Method to get available balances in the supported currencies
    as well as the notional value in the currency specified

    Args:
        auth: Gemini authentication object
        currency: supported three-letter fiat currency code


    Returns:
        List of FundManagement object
    """
    path = f"/v1/notionalbalances/{currency}"

    res = auth.make_request(endpoint=path)

    all_notional_balances = []

    for i in range(len(res)):
        balance = FundManagement(auth=auth, fund_data=res[i])
        all_notional_balances.append(balance)

    return all_notional_balances

get_payment_methods(auth) classmethod

Method to get data on balances in the account and linked banks

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required

Returns:

Type Description
FundManagement

FundManagement object

Source code in gemini_api/endpoints/fund_management.py
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
@classmethod
def get_payment_methods(
    cls,
    auth: Authentication,
) -> FundManagement:

    """
    Method to get data on balances in the account and linked banks

    Args:
        auth: Gemini authentication object

    Returns:
        FundManagement object
    """
    path = "/v1/payments/methods"

    res = auth.make_request(endpoint=path)

    return FundManagement(auth=auth, fund_data=res)

get_transfers(auth, since=None, show_completed_deposit_advances=None, limit_transfers=None, currency=None) classmethod

Method to get transfers - shows deposits and withdrawals in the supported currencies. When deposits show as Advanced or Complete status, they are available for trading.

This method does not currently show cancelled advances, returned outgoing wires or ACH transactions, or other exceptional transaction circumstances.

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
since str

Date in YYYYMMDD format

None
show_completed_deposit_advances bool

Display completed deposit advances

None
limit_transfers int

The maximum number of transfers to return

None
currency str

Currency code symbols

None

Returns:

Type Description
List[FundManagement]

List of FundManagement object

Source code in gemini_api/endpoints/fund_management.py
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
@classmethod
def get_transfers(
    cls,
    auth: Authentication,
    since: str = None,
    show_completed_deposit_advances: bool = None,
    limit_transfers: int = None,
    currency: str = None,
) -> List[FundManagement]:

    """
    Method to get transfers - shows deposits and withdrawals in the
    supported currencies. When deposits show as Advanced or Complete
    status, they are available for trading.

    This method does not currently show cancelled advances,
    returned outgoing wires or ACH transactions,
    or other exceptional transaction circumstances.

    Args:
        auth: Gemini authentication object
        since: Date in YYYYMMDD format
        show_completed_deposit_advances: Display completed deposit advances
        limit_transfers: The maximum number of transfers to return
        currency: Currency code symbols

    Returns:
        List of FundManagement object
    """
    path = "/v1/transfers"

    data: Dict[str, Any] = {}

    if since is not None:
        data["timestamp"] = date_to_unix_ts(since)
    if currency is not None:
        data["currency"] = currency
    if limit_transfers is not None:
        data["limit_transfers"] = limit_transfers
    if show_completed_deposit_advances is not None:
        data[
            "show_completed_deposit_advances"
        ] = show_completed_deposit_advances

    res = auth.make_request(endpoint=path, payload=data)

    all_transfers = []

    for i in range(len(res)):
        transfer = FundManagement(auth=auth, fund_data=res[i])
        all_transfers.append(transfer)

    return all_transfers

is_override() property

Property for the value that shows if an override on the customer's account for free withdrawals exists

Returns:

Type Description
bool

True if override exists, False otherwise

Source code in gemini_api/endpoints/fund_management.py
446
447
448
449
450
451
452
453
454
455
@property
def is_override(self) -> bool:
    """
    Property for the value that shows if an override on the
    customer's account for free withdrawals exists

    Returns:
        True if override exists, False otherwise
    """
    return self._is_override

label() property

Property for the label if provided upon creation of the cryptocurrency address

Returns:

Type Description
str

address

Source code in gemini_api/endpoints/fund_management.py
391
392
393
394
395
396
397
398
399
400
@property
def label(self) -> str:
    """
    Property for the label if provided upon creation of the
    cryptocurrency address

    Returns:
        address
    """
    return self._label

message() property

Property for the human-readable English message describing the withdrawal - only shown for BTC, ZEC, LTC and BCH withdrawals. Also can be the error message description for failed requests.

Returns:

Type Description
str

Message

Source code in gemini_api/endpoints/fund_management.py
434
435
436
437
438
439
440
441
442
443
444
@property
def message(self) -> str:
    """
    Property for the human-readable English message describing
    the withdrawal - only shown for BTC, ZEC, LTC and BCH withdrawals.
    Also can be the error message description for failed requests.

    Returns:
        Message
    """
    return self._message

method() property

Property for the transfer - if fiat currency, the method field will attempty to supply "ACH", "WIRE" or "SEN". If the transfer is internal, the method field will return "Internal"

Returns:

Type Description
str

Transfer method

Source code in gemini_api/endpoints/fund_management.py
285
286
287
288
289
290
291
292
293
294
295
@property
def method(self) -> str:
    """
    Property for the transfer - if fiat currency, the method field
    will attempty to supply "ACH", "WIRE" or "SEN". If the transfer
    is internal, the method field will return "Internal"

    Returns:
        Transfer method
    """
    return self._method

monthly_limit() property

Property for the total number of allowable fee-free withdrawals

Returns:

Type Description
int

Number of fee-free withdrawals

Source code in gemini_api/endpoints/fund_management.py
457
458
459
460
461
462
463
464
465
@property
def monthly_limit(self) -> int:
    """
    Property for the total number of allowable fee-free withdrawals

    Returns:
        Number of fee-free withdrawals
    """
    return self._monthly_limit

montly_remaining() property

Property for the total number of allowable fee-free withdrawals left to use

Returns:

Type Description
int

Number of fee-free withdrawals left to use

Source code in gemini_api/endpoints/fund_management.py
467
468
469
470
471
472
473
474
475
476
@property
def montly_remaining(self) -> int:
    """
    Property for the total number of allowable fee-free withdrawals
    left to use

    Returns:
        Number of fee-free withdrawals left to use
    """
    return self._monthly_remaining

network() property

Property for the network

Returns:

Type Description
str

address

Source code in gemini_api/endpoints/fund_management.py
402
403
404
405
406
407
408
409
410
@property
def network(self) -> str:
    """
    Property for the network

    Returns:
        address
    """
    return self._network

outputidx() property

Property for the output index for transactions for when the currency is a cryptocurrency

Returns:

Type Description
int

Output index

Source code in gemini_api/endpoints/fund_management.py
308
309
310
311
312
313
314
315
316
317
@property
def outputidx(self) -> int:
    """
    Property for the output index for transactions for when the
    currency is a cryptocurrency

    Returns:
        Output index
    """
    return self._outputidx

purpose() property

Property for the administrative field to supply a reason for certain types of advances

Returns:

Type Description
str

Purpose

Source code in gemini_api/endpoints/fund_management.py
330
331
332
333
334
335
336
337
338
339
@property
def purpose(self) -> str:
    """
    Property for the administrative field to supply a reason for
    certain types of advances

    Returns:
        Purpose
    """
    return self._purpose

reason() property

Property for the reason of errors

Returns:

Type Description
str

Short error description

Source code in gemini_api/endpoints/fund_management.py
498
499
500
501
502
503
504
505
506
@property
def reason(self) -> str:
    """
    Property for the reason of errors

    Returns:
        Short error description
    """
    return self._reason

reference_id() property

Property for the reference id for the new bank addition request

Returns:

Type Description
str

Reference id

Source code in gemini_api/endpoints/fund_management.py
478
479
480
481
482
483
484
485
486
@property
def reference_id(self) -> str:
    """
    Property for the reference id for the new bank addition request

    Returns:
        Reference id
    """
    return self._reference_id

result() property

Property for the result upon errors or the state of a request

Returns:

Type Description
str

Result

Source code in gemini_api/endpoints/fund_management.py
488
489
490
491
492
493
494
495
496
@property
def result(self) -> str:
    """
    Property for the result upon errors or the state of a request

    Returns:
        Result
    """
    return self._result

sen_withdrawal(auth, bankId, amount) classmethod

Method to withdraw USD via SEN

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
bankId str

Unique ID for your SEN bank account

required
amount float

Amount (USD) to transfer to your account

required

Returns:

Type Description
FundManagement

FundManagement object

Source code in gemini_api/endpoints/fund_management.py
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
@classmethod
def sen_withdrawal(
    cls, auth: Authentication, bankId: str, amount: float
) -> FundManagement:

    """
    Method to withdraw USD via SEN

    Args:
        auth: Gemini authentication object
        bankId: Unique ID for your SEN bank account
        amount: Amount (USD) to transfer to your account

    Returns:
        FundManagement object
    """
    path = "/v1/payments/sen/withdraw"

    res = auth.make_request(endpoint=path)

    return FundManagement(auth=auth, fund_data=res)

status() property

Property for the transfer status which is either 'Advanced' or 'Complete'

Returns:

Type Description
str

Status

Source code in gemini_api/endpoints/fund_management.py
223
224
225
226
227
228
229
230
231
232
@property
def status(self) -> str:
    """
    Property for the transfer status which is either 'Advanced' or
    'Complete'

    Returns:
        Status
    """
    return self._status

timestampms() property

Property for the time of the transfer in milliseconds or the creation of the cryptocurrency address

Returns:

Type Description
int

Number of milliseconds since 1970-01-01 UTC

Source code in gemini_api/endpoints/fund_management.py
234
235
236
237
238
239
240
241
242
243
@property
def timestampms(self) -> int:
    """
    Property for the time of the transfer in milliseconds or the
    creation of the cryptocurrency address

    Returns:
        Number of milliseconds since 1970-01-01 UTC
    """
    return self._timestampms

tx_hash() property

Property for the transaction hash for when the currency is a cryptocurrency - only shown for ETH and GUSD for withdrawals

Returns:

Type Description
str

Transaction hash

Source code in gemini_api/endpoints/fund_management.py
297
298
299
300
301
302
303
304
305
306
@property
def tx_hash(self) -> str:
    """
    Property for the transaction hash for when the currency is a
    cryptocurrency - only shown for ETH and GUSD for withdrawals

    Returns:
        Transaction hash
    """
    return self._tx_hash

tx_time() property

Property for the time of custody fee record

Returns:

Type Description
str

Time of custody fee record

Source code in gemini_api/endpoints/fund_management.py
341
342
343
344
345
346
347
348
349
@property
def tx_time(self) -> str:
    """
    Property for the time of custody fee record

    Returns:
        Time of custody fee record
    """
    return self._tx_time

withdraw_crypto(auth, currency, address, amount, client_transfer_id=None) classmethod

Method to withdraw crypto funds

Parameters:

Name Type Description Default
auth Authentication

Gemini authentication object

required
currency str

Currency code symbols

required
address str

Standard string format of cryptocurrency address

required
amount str

Quoted decimal amount to withdraw

required
client_transfer_id str

Unique identifier for withdrawal, uuid4 format

None

Returns:

Type Description
FundManagement

FundManagement object

Source code in gemini_api/endpoints/fund_management.py
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
@classmethod
def withdraw_crypto(
    cls,
    auth: Authentication,
    currency: str,
    address: str,
    amount: str,
    client_transfer_id: str = None,
) -> FundManagement:

    """
    Method to withdraw crypto funds

    Args:
        auth: Gemini authentication object
        currency: Currency code symbols
        address: Standard string format of cryptocurrency address
        amount: Quoted decimal amount to withdraw
        client_transfer_id: Unique identifier for withdrawal, uuid4 format

    Returns:
        FundManagement object
    """
    path = f"/v1/withdraw/{currency}"

    data = {
        "address": address,
        "amount": amount,
    }

    if client_transfer_id is not None:
        data["client_transfer_id"] = client_transfer_id

    res = auth.make_request(endpoint=path, payload=data)

    return FundManagement(auth=auth, fund_data=res)

withdrawal_id() property

Property for the withdrawal id - only shown for BTC, ZEC, LTC and BCH withdrawals

Returns:

Type Description
str

Unique withdrawal id

Source code in gemini_api/endpoints/fund_management.py
423
424
425
426
427
428
429
430
431
432
@property
def withdrawal_id(self) -> str:
    """
    Property for the withdrawal id - only shown for BTC, ZEC, LTC
    and BCH withdrawals

    Returns:
        Unique withdrawal id
    """
    return self._withdrawal_id