BigONE API¶
client module¶
-
class
bigone.client.
Client
(api_key, api_secret)[source]¶ Bases:
object
-
API_URL
= 'https://big.one/api/v2'¶
-
SIDE_BID
= 'BID'¶
-
SIDE_ASK
= 'ASK'¶
-
__init__
(api_key, api_secret)[source]¶ Big.One API Client constructor
Parameters: - api_key (str) – Api Key
- api_key – Api Secret
client = Client(api_key, api_secret)
-
get_accounts
()[source]¶ List accounts of current user
accounts = client.get_accounts()
Returns: list of dicts [ { "type": "account", "user_id": "5c1b7700-c903-41f8-9b4c-d78be9b2685d", "account_id": "7eb4201b-9ae8-450d-819a-1c7dfd272e3d", "account_type": "BTC", "account_name": "Bitcoin", "account_logo_url": "https://storage.googleapis.com/big-one/coins/BTC.svg", "public_key": "16zy7YGERPEygQitMFaqP4afPJBZeo2WK6", "system_account": "", "active_balance": "0.00000000", "frozen_balance": "0.00000000", "estimated_btc_price": "1.00000000", "verification": "EMAIL_VERIFIED", "has_asset_pin": false }, { "type": "account", "user_id": "5c1b7700-c903-41f8-9b4c-d78be9b2685d", "account_id": "3d7c2353-add3-4e03-8637-c78e4d2b17cb", "account_type": "ETH", "account_name": "Ether", "account_logo_url": "https://storage.googleapis.com/big-one/coins/ETH.svg", "public_key": "0xaefde180aae6e0916632dabfdd2f8733c8a03826", "system_account": "", "active_balance": "0.00000000", "frozen_balance": "0.00000000", "estimated_btc_price": "0.06500000", "verification": "EMAIL_VERIFIED", "has_asset_pin": false } ]
Raises: BigoneRequestException, BigoneAPIException
-
get_account
(currency)[source]¶ Get account for a currency
Parameters: currency (str) – Name of currency account = client.get_account('BTC')
Returns: dict { "type": "account", "user_id": "5c1b7700-c903-41f8-9b4c-d78be9b2685d", "account_id": "7eb4201b-9ae8-450d-819a-1c7dfd272e3d", "account_type": "BTC", "account_name": "Bitcoin", "account_logo_url": "https://storage.googleapis.com/big-one/coins/BTC.svg", "public_key": "16zy7YGERPEygQitMFaqP4afPJBZeo2WK6", "system_account": "", "active_balance": "0.00000000", "frozen_balance": "0.00000000", "estimated_btc_price": "1.00000000", "verification": "EMAIL_VERIFIED", "has_asset_pin": false, "withdrawal": { "fee": "0.002", "fee_type": "BTC" }, "deposits": [], "withdrawals": [], "recipients": [] }
Raises: BigoneRequestException, BigoneAPIException
-
get_markets
()[source]¶ List markets
https://open.big.one/docs/api_market.html#all-markets
markets = client.get_markets()
Returns: list of dicts [ { "uuid": "d2185614-50c3-4588-b146-b8afe7534da6", "quoteScale": 8, "quoteAsset": { "uuid": "0df9c3c3-255a-46d7-ab82-dedae169fba9", "symbol": "BTC", "name": "Bitcoin" }, "name": "BTG/BTC", "baseScale": 4, "baseAsset": { "uuid": "5df3b155-80f5-4f5a-87f6-a92950f0d0ff", "symbol": "BTG", "name": "Bitcoin Gold" } } ]
Raises: BigoneRequestException, BigoneAPIException
-
get_tickers
()[source]¶ List market tickers
https://open.big.one/docs/api_tickers.html#tickers-of-all-market
markets = client.get_tickers()
Returns: list of dicts [ { "volume": null, "open": "1.0000000000000000", "market_uuid": "ETH-EOS", "low": null, "high": null, "daily_change_perc": "0", "daily_change": "0E-16", "close": "1.0000000000000000", "bid": { "price": "1.0000000000000000", "amount": "106.0000000000000000" }, "ask": { "price": "45.0000000000000000", "amount": "4082.3283464000000000" } } ]
Raises: BigoneRequestException, BigoneAPIException
-
get_ticker
(symbol)[source]¶ Get symbol market details
https://open.big.one/docs/api_tickers.html#ticker-of-one-market
Parameters: symbol (str) – Name of symbol # using market ID market = client.get_ticker('ETH-BTC') # using market UUID market = client.get_ticker('d2185614-50c3-4588-b146-b8afe7534da6')
Returns: dict { "volume": null, "open": "42.0000000000000000", "market_uuid": "BTC-EOS", "low": "42.0000000000000000", "high": null, "daily_change_perc": "0", "daily_change": "0E-16", "close": "42.0000000000000000", "bid": { "price": "42.0000000000000000", "amount": "3.3336371100000000" }, "ask": { "price": "45.0000000000000000", "amount": "4082.3283464000000000" } }
Raises: BigoneRequestException, BigoneAPIException
-
get_order_book
(symbol)[source]¶ Get symbol market details
Parameters: symbol (str) – Name of symbol # Using market ID book = client.get_order_book('ETH-BTC') # Using market UUID book = client.get_order_book('d2185614-50c3-4588-b146-b8afe7534da6')
Returns: dict { "market_uuid": "BTC-EOS", "bids": [ { "price": "42", "order_count": 4, "amount": "23.33363711" } ], "asks": [ { "price": "45", "order_count": 2, "amount": "4193.3283464" } ] }
Raises: BigoneRequestException, BigoneAPIException
-
get_market_trades
(symbol, after=None, before=None, first=None, last=None)[source]¶ Get market trades - max 50
https://open.big.one/docs/api_market_trade.html#trades-of-a-market
Parameters: - symbol (str) – Name of symbol
- after (int) – Return trades after this id
- before (int) – Return trades before this id
- first (int) – Slicing count
- last (int) – Slicing count
trades = client.get_market_trades('ETH-BTC') # using after trade ID trades = client.get_market_trades('ETH-BTC', after=1) # using first slice value trades = client.get_market_trades('ETH-BTC', first=20)
Returns: list of dicts { "edges": [ { "node": { "taker_side": "BID", "price": "46.1450000000000000", "market_uuid": "BTC-EOS", "id": 1, "amount": "0.2465480000000000" }, "cursor": "dGVzdGN1cmVzZQo=" } ], "page_info": { "end_cursor": "dGVzdGN1cmVzZQo=", "start_cursor": "dGVzdGN1cmVzZQo=", "has_next_page": true, "has_previous_page": false } }
Raises: BigoneRequestException, BigoneAPIException
-
create_order
(symbol, side, price, amount)[source]¶ Create a new order
Parameters: - symbol (str) – Name of symbol
- side (str) – side of order (BID or ASK)
- price (str) – Price as string
- amount (str) – Amount as string
order = client.create_order('ETH-BTC', 'BID', '1.0', '1.0')
Returns: dict { "id": 10, "market_uuid": "BTC-EOS", "price": "10.00", "amount": "10.00", "filled_amount": "9.0", "avg_deal_price": "12.0", "side": "ASK", "state": "FILLED" }
Raises: BigoneRequestException, BigoneAPIException
-
get_orders
(symbol, after=None, before=None, first=None, last=None, side=None, state=None)[source]¶ Get a list of orders
Parameters: - symbol (str) – Name of symbol
- after (int) – Return trades after this id
- before (int) – Return trades before this id
- first (int) – Slicing count
- last (int) – Slicing count
- side (str) – Order Side ASK|BID
- state (str) – Order State CANCELED|FILLED|PENDING
orders = client.get_orders('ETH-BTC')
Returns: dict { "edges": [ { "node": { "id": 10, "market_uuid": "d2185614-50c3-4588-b146-b8afe7534da6", "price": "10.00", "amount": "10.00", "filled_amount": "9.0", "avg_deal_price": "12.0", "side": "ASK", "state": "FILLED" }, "cursor": "dGVzdGN1cmVzZQo=" } ], "page_info": { "end_cursor": "dGVzdGN1cmVzZQo=", "start_cursor": "dGVzdGN1cmVzZQo=", "has_next_page": true, "has_previous_page": false } }
Raises: BigoneRequestException, BigoneAPIException
-
get_order
(order_id)[source]¶ Get an order
https://open.big.one/docs/api_orders.html#get-one-order
Parameters: order_id (str) – Id of order orders = client.get_order('10')
Returns: dict { "id": 10, "market_uuid": "d2185614-50c3-4588-b146-b8afe7534da6", "price": "10.00", "amount": "10.00", "filled_amount": "9.0", "avg_deal_price": "12.0", "side": "ASK", "state": "FILLED" }
Raises: BigoneRequestException, BigoneAPIException
-
cancel_order
(order_id)[source]¶ Cancel an order
https://open.big.one/docs/api_orders.html#cancle-order
Parameters: order_id (str) – Id of order res = client.cancel_order('10')
Returns: dict {}
Raises: BigoneRequestException, BigoneAPIException
-
cancel_orders
()[source]¶ Cancel all orders
https://open.big.one/docs/api_orders.html#cancle-all-orders
res = client.cancel_orders()
Returns: dict {}
Raises: BigoneRequestException, BigoneAPIException
-
get_trades
(symbol=None, after=None, before=None, first=None, last=None)[source]¶ Get a list of your trades
Parameters: - symbol (str) – Name of symbol
- before (int) – Return trades before this id
- first (int) – Slicing count
- last (int) – Slicing count
trades = client.get_trades('ETH-BTC')
Returns: dict { "edges": [ { "node": { "viewer_side": "ASK" // ASK, BID, SELF_TRADING "taker_side": "BID", "price": "46.1450000000000000", "market_uuid": "BTC-EOS", "id": 1, "amount": "0.2465480000000000" }, "cursor": "dGVzdGN1cmVzZQo=" } ], "page_info": { "end_cursor": "dGVzdGN1cmVzZQo=", "start_cursor": "dGVzdGN1cmVzZQo=", "has_next_page": true, "has_previous_page": false } }
Raises: BigoneRequestException, BigoneAPIException
-
withdrawals
(first=None, after=None)[source]¶ Get a list of withdrawals
https://open.big.one/docs/api_withdrawal.html#get-withdrawals-of-user
Parameters: - first (str) – Slicing count
- after (str) – Return withdrawals after this value
withdrawal = client.withdrawals()
Returns: dict { "edges": [ { "node": { "id": 10, "customer_id": "ETH", "asset_uuid": "ETH", "amount": "5", "state": "CONFIRMED", "note": "2018-03-15T16:13:45.610463Z", "txid": "0x4643bb6b393ac20a6175c713175734a72517c63d6f73a3ca90a15356f2e967da0", "completed_at": "2018-03-15T16:13:45.610463Z", "inserted_at": "2018-03-15T16:13:45.610463Z", "is_internal": true, "target_address": "0x4643bb6b393ac20a6175c713175734a72517c63d6f7" }, "cursor": "dGVzdGN1cmVzZQo=" } ], "page_info": { "end_cursor": "dGVzdGN1cmVzZQo=", "start_cursor": "dGVzdGN1cmVzZQo=", "has_next_page": true, "has_previous_page": false } }
Raises: BigoneRequestException, BigoneAPIException
-
get_deposits
(first=None, after=None)[source]¶ Get a list of deposits
https://open.big.one/docs/api_deposit.html#deposit-of-user
Parameters: - first (str) – Slicing count
- after (str) – Return withdrawals after this value
# get all deposits deposits = client.get_deposits() # get BTC deposits deposits = client.get_deposits('BTC')
Returns: list of dicts [ { "type": "deposit", "deposit_id": "7b76603c-db87-4c4a-b36f-9981058d885e", "deposit_type": "ETH", "amount": "1.00000000", "confirmations": 2231, "state": "confirmed", "scanner_url": "https://etherscan.io/tx/0x181a1d616b5b07d5a404636c527ca5432878664d4b85a20976bbd72c07e58abe", "created_at": "2017-09-06T07:53:41.297047856Z" } ]
Raises: BigoneRequestException, BigoneAPIException
-