Skip to main content

Talk to the Gemini Exchange API

Project description

geminitools

Geminitools is a Python package that can help you talk to the Gemini Exchange REST API.

Geminitools is a simple API. You can't interface 1:1 with the Gemini Exchange API with geminitools. There are other packages for that. Instead, the main thing you can do is buy. As of yet there is no sell option (why would you want to anyway?).

Installation

pip install geminitools

Example Usage

import geminitools

gem = geminitools.Gem('https://api.gemini.com', 'key', 'secret')

gem.place_cost_buy_order('BTCUSD', 10, 70000)

API

class geminitools.Gem(base_url, key, secret)

get_supported_symbols()

Make a call to the /v1/symbols endpoint and return a list of accepted symbols.

get_ticker_price(symbol, price_type='ask')

Make a call to the /v1/pubticker/ endpoint and return the value defined by price_type - defaults to 'ask', the asking price.

convert_cost_to_asset_amount(symbol, cost, rounded=8)

Divides cost by the current ticker price given by symbol rounding to rounded decimal places, and returns the resulting asset amount.

E.g. if symbol is 'btcusd', cost is 50 (USD) and the current ticker price is 60000 (USD), the result would be 50 / 60000 = 0.00083333 (BTC)

place_amount_buy_order(symbol, amount, price)

Make a call to the /v1/order/new endpoint, placing a buy order for amount with a limit of price, and returns the API response. If you pass symbol 'BTCUSD', amount would be the quantity of BTC you want to buy, while price would be the max USD market price you're willing to pay.

E.g. amount = 0.1 and price = 10000 would cause 0.1 BTC to be bought if the price of BTC is less than or equal to 10000 USD.

place_cost_buy_order(symbol, cost, price)

Similar to place_asset_buy_order but calculates the amount of the asset to buy based on the cost passed. Returns the API response.

E.g. Passing symbol 'BTCUSD' and a cost value of 10 would cause the order of 10 USD worth of BTC to be bought.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geminitools-0.0.2.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geminitools-0.0.2-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file geminitools-0.0.2.tar.gz.

File metadata

  • Download URL: geminitools-0.0.2.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.3

File hashes

Hashes for geminitools-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d54d630283aec41cb5767a02c072c2e940a7ed9dcc09043dc9208e6fb838b5c0
MD5 3cad5e21ff9a9908b9dc5993e8c81bbf
BLAKE2b-256 90ed753184550bbe830cfd4f48900ee9850a7f65f37387d6858712626319537c

See more details on using hashes here.

File details

Details for the file geminitools-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: geminitools-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.3

File hashes

Hashes for geminitools-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 df448c769e166c2b045fdf5a690f86250527238ca3ae434a35de971cb5f7e59c
MD5 361d4468d9e5e85fb5f39ee982839fdd
BLAKE2b-256 67b37551368dc3caef1719f6335b59801e5abe7ddd613feec3cc907a364a1cdb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page