This is an UNOFFICIAL wrapper for FTX exchange HTTP API written in Python 3.7
The library can be used to fetch market data, make trades, place orders or create third-party clients
USE THIS WRAPPER AT YOUR OWN RISK, I WILL NOT CORRESPOND TO ANY LOSES
- Except OTC and Option, implementation of all public and private endpoints
- Simple handling of authentication with API key and secret
- For asset safety, WITHDRAWAL function will never be supported !
If useful, buy me a coffee?
- ETH: 0x00000000051CBcE3fD04148CcE2c0adc7c651829 (brendanc.eth)
$ git clone https://github.com/LeeChunHao2000/ftx-api-wrapper-python3
- This wrapper requires requests
- Register an account with FTX exchange (referral link)
- Generate API key and secret, assign relevant permissions to it
- Clone this repository, and put in the key and secret
- Write your own trading policies
This is an introduction on how to get started with FTX client. First, make sure the FTX library is installed.
The next thing you need to do is import the library and get an instance of the client:
from FTX.client import Client
client = Client('PUY_MY_API_KEY_HERE', 'PUY_MY_API_SECRET_HERE')
>>> from FTX.client import Client
>>> client = Client('PUY_MY_API_KEY_HERE', 'PUY_MY_API_SECRET_HERE')
>>> result = client.get_public_orderbook('BTC/USD', 1)
>>> result
{'asks': [[10854.5, 11.856]], 'bids': [[10854.0, 0.4315]]}
>>> result['asks']
[[10854.5, 11.856]]
>>> result['bids']
[[10854.0, 0.4315]]
>>> import pandas as pd
>>> result = pd.DataFrame(client.get_private_account_positions())
>>> result = result.sort_values(by=['realizedPnl'], ascending=False)
>>> result
collateralUsed cost entryPrice ... side size unrealizedPnl
0 0.00000 0.000 NaN ... buy 0.00 0.0
49 0.00000 0.000 NaN ... buy 0.00 0.0
4 535.09500 2972.750 594.5500 ... buy 5.00 0.0
35 206.93750 2069.375 82.7750 ... buy 25.00 0.0
3 0.00000 0.000 NaN ... buy 0.00 0.0
5 152.28000 1522.800 2.5380 ... buy 600.00 0.0
Bugfixes
- Fixed a bug with function of cancel orders
Features
- Add Spot Margin Support
- Birth!