Git Product home page Git Product logo

ftx-api-wrapper-python3's Introduction

FTX-Trader

Warning

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

Features

  • 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 !

Donate

If useful, buy me a coffee?

  • ETH: 0xA9D89A5CAf6480496ACC8F4096fE254F24329ef0 (brendanc.eth)

Installation

$ git clone https://github.com/LeeChunHao2000/ftx-api-wrapper-python3

Requirement

  1. Register an account with FTX exchange (referral link)
  2. Generate API key and secret, assign relevant permissions to it
  3. Clone this repository, and put in the key and secret
  4. Write your own trading policies

Quickstart

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')

Get ordedrbook

>>> 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]]

Positions (DataFrame)

>>> 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

Version Logs

2020-12-24

Bugfixes

  • Fixed a bug with function of cancel orders

Features

  • Add Spot Margin Support

2020-09-14

  • Birth!

ftx-api-wrapper-python3's People

Contributors

leechunhao2000 avatar panda850819 avatar zevaverbach avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.