Giter Site home page Giter Site logo

quan-digital / ftx Goto Github PK

View Code? Open in Web Editor NEW
165.0 165.0 58.0 73 KB

Library for connecting to the FTX API.

License: MIT License

Python 100.00%
api-client api-rest bitcoin crypto-exchange crypto-exchange-api crypto-exchanges cryptocurrency ftx

ftx's People

Contributors

agentydragon avatar atkinson avatar bvdaakster avatar cesar128 avatar charlesfr avatar choffstein avatar fahadfadi avatar kewlfft avatar leonarduschen avatar thomgabriel avatar vladkochetov007 avatar wolph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ftx's Issues

Authentication exception

I can't seem to get the authentication to work successfully. Is anyone else having this problem? I've attached a code example below. The api_key and api_secret I've obviously changed out but they would be copied and pasted from the key generated on my profile page. I've tried generating a new key pair and have given it all permissions but still no luck.

import ftx

api_key = 'my_api_key_pasted'
api_secret = 'my_api_secret_key_pasted'
client = ftx.FtxClient(api_key=api_key, api_secret=api_secret)

acc_info = client.get_account_info()
print(acc_info)
Traceback (most recent call last):
  File "lending_history.py", line 7, in <module>
    acc_info = client.get_account_info()
  File "/mnt/c/Users/Username/PycharmProjects/ftx_lending/src/ftx/ftx/api.py", line 73, in wrapped
    return fn(self, *args, **kwargs)
  File "/mnt/c/Users/Username/PycharmProjects/ftx_lending/src/ftx/ftx/api.py", line 78, in get_account_info
    return self._get(f'account')
  File "/mnt/c/Users/Username/PycharmProjects/ftx_lending/src/ftx/ftx/api.py", line 20, in _get
    return self._request('GET', path, params=params)
  File "/mnt/c/Users/Username/PycharmProjects/ftx_lending/src/ftx/ftx/api.py", line 34, in _request
    return self._process_response(response)
  File "/mnt/c/Users/Username/PycharmProjects/ftx_lending/src/ftx/ftx/api.py", line 59, in _process_response
    raise Exception(data['error'])
Exception: Not logged in

Doesnt get all the trades.

When I compare the data it gives from get_trades vs the one on the platform it doesnt match. If the trades are rare then everything is fine. As soon as there are more than 2 trades in one second it skips alot of them. Is there another way how to get all trades?

AttributeError: 'NoneType' object has no attribute 'encode'

I cannot login as api and secret key


In [3]: client = ftx.FtxClient("xxx", "xxx")

In [4]: client.get_balances()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-12-84f4855be095> in <module>
----> 1 client.get_balances()

~/opt/anaconda3/lib/python3.7/site-packages/ftx/api.py in wrapped(self, *args, **kwargs)
     69                 raise TypeError("You must be authenticated to use this method")
     70             else:
---> 71                 return fn(self, *args, **kwargs)
     72         return wrapped
     73 

~/opt/anaconda3/lib/python3.7/site-packages/ftx/api.py in get_balances(self)
    164     @authentication_required
    165     def get_balances(self) -> List[dict]:
--> 166         return self._get(f'wallet/balances')
    167 
    168     @authentication_required

~/opt/anaconda3/lib/python3.7/site-packages/ftx/api.py in _get(self, path, params)
     18 
     19     def _get(self, path: str, params: Optional[Dict[str, Any]] = None) -> Any:
---> 20         return self._request('GET', path, params=params)
     21 
     22     def _post(self, path: str, params: Optional[Dict[str, Any]] = None) -> Any:

~/opt/anaconda3/lib/python3.7/site-packages/ftx/api.py in _request(self, method, path, **kwargs)
     29         request = Request(method, self._base_url + path, **kwargs)
     30         if self._api_key:
---> 31             self._sign_request(request)
     32         response = self._session.send(request.prepare())
     33 

~/opt/anaconda3/lib/python3.7/site-packages/ftx/api.py in _sign_request(self, request)
     40         if prepared.body:
     41             signature_payload += prepared.body
---> 42         signature = hmac.new(self._api_secret.encode(), signature_payload, 'sha256').hexdigest()
     43         request.headers['FTX-KEY'] = self._api_key
     44         request.headers['FTX-SIGN'] = signature

AttributeError: 'NoneType' object has no attribute 'encode'

Bodchange / 24hour change gives wrong data

image
When I'm printing my percentage change I get to see the wrong data in comparison to the FTX site. I have this problem with other pairings as well. I also have this problem with the 24h change.

Is there anybody who knows what I'm doing wrong?

Appreciate any suggestions. Thanks!

Take Profit and Trailing Stop not working.

"""
To send a Stop Market order, set type='stop' and supply a trigger_price
To send a Stop Limit order, also supply a limit_price
To send a Take Profit Market order, set type='trailing_stop' and supply a trigger_price
To send a Trailing Stop order, set type='trailing_stop' and supply a trail_value
"""

This is commented in the api.py. Every way i try to post a take profit or trailing stop or even a stop (as a take_profit value) i receive an error, usually saying the trigger price is too high, which is not possible when putting a take profit on a long position.

Has anyone else had similar issues with placing orders?

Appreciate any suggestions. Thanks

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.