Giter VIP home page Giter VIP logo

gdax-python-api's People

Contributors

csko avatar davluangu avatar pyup-bot avatar tmitrovich 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gdax-python-api's Issues

Invalid signature using authenticating with websockets

I'm writing a script to subscribe to the authenticated "user" channel using the code below (which used orderbook.py as its basis) and I'm passing the api_key/api_secret and passphrase through (I've redacted them in this code example)

The error I get back is:

{'message': 'Sorry, you could not be authenticated: Bad Request', 'reason': 'invalid signature', 'type': 'error'}

Any ideas ?

import asyncio
import pprint

from gdax.websocket_feed_listener import WebSocketFeedListener

class User(WebSocketFeedListener):

    def __init__(self, product_ids='ETH-USD', api_key=None, api_secret=None,
                 passphrase=None, use_heartbeat=False,
                 trade_log_file_path=None):

        super().__init__(product_ids=product_ids,
                         channels='user',
                         api_key=api_key,
                         api_secret=api_secret,
                         passphrase=passphrase,
                         use_heartbeat=use_heartbeat
                         )

        if not isinstance(product_ids, list):
            product_ids = [product_ids]

    async def __aenter__(self):

        await super().__aenter__()

        return self

    async def handle_message(self):

        try:
            message = await self._recv()
        except aiohttp.ServerDisconnectedError as exc:
            logging.error(
                f'Error: Exception: f{exc}. Re-initializing websocket.')
            await self.__aexit__(None, None, None)
            await self.__aenter__()
            return

        return message


async def run_user():  # pragma: no cover
    async with User(
            ['ETH-USD'],
            api_key="XXXXXXXX",
            api_secret="XXXXXXXX",
            passphrase="XXXXXXXX"
    ) as user:
        while True:
            message = await user.handle_message()
            if message is None:
                continue

            pprint.pprint(message)

if __name__ == "__main__":  # pragma: no cover
    loop = asyncio.get_event_loop()
    loop.run_until_complete(run_user())

Initial Update

Hi ๐Ÿ‘Š

This is my first visit to this fine repo, but it seems you have been working hard to keep all dependencies updated so far.

Once you have closed this issue, I'll create separate pull requests for every update as soon as I find one.

That's it for now!

Happy merging! ๐Ÿค–

How to get a list of open positions?

How do I get a list of open positions via the API? That is, suppose I BUY two BTC-USD at (say) $9500 and $9600, with sizes of 0.6 and 1.2 respectively. How would I a list of these open positions? The fill method gets me the full history, but it doesn't tell me which positions are still open. I need a quick way of making sure my app is in sync with the exchange... Thanks

No information how to retrieve other WebSocket informat

The examples for the module show how to subscribe to a websocket for the Orderbook, and it shows you how to use the REST API interface to place an order.

However, there is no information or instructions on how to subscribe to a websocket to see the status of those orders or to receive live updates for those orders or your account. Yes, one could use the REST interface, but that doesn't inform you as and when things happen.

SSL verification fails

Hi,

I installed the API and tried to run the example code, but I keep getting the same error:

aiohttp.client_exceptions.ClientConnectorError: [Errno 1] Cannot connect to host ws-feed.gdax.com:443 ssl:True [Can not connect to ws-feed.gdax.com:443 [[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)]]

Does anyone know how to fix this issue?

Namespace conflict with "gdax-python"

There is a namespace conflict between gdax-python-api and gdax-python. Both packages install their code under the gdax namespace. This makes it impossible to use them in parallel

AFAIK there is no rule for handling such namespace conflicts so the resolution, if any, is completely up to you. Nevertheless IMHO it would be nice to be able to use both packages and your package is the newer one. That's why I am opening the issue here.

https://github.com/danpaquin/gdax-python
https://www.python.org/dev/peps/pep-0541/
https://www.python.org/dev/peps/pep-0423/

No ability to trade "post only" (commission free)

The buy / post functions are missing the optional post_only flag. e.g:

{ "id": "d0c5340b-6d6c-49d9-b567-48c4bfca13d2", "price": "0.10000000", "size": "0.01000000", "product_id": "BTC-USD", "side": "buy", "stp": "dc", "type": "limit", "time_in_force": "GTC", "post_only": false, "created_at": "2016-12-08T20:02:28.53864Z", "fill_fees": "0.0000000000000000", "filled_size": "0.00000000", "executed_value": "0.0000000000000000", "status": "pending", "settled": false }

As per the GDAX API docs:

https://docs.gdax.com/#orders

'Post Only' will ensure that the order is only executed if the entire order can be posted to the order book.

If any part of the order crosses the spread to fill an existing order, an error will be displayed and the order will not be executed. This is useful for guaranteeing that the entire order is subject to a 0% maker order fee rate.

cancel_order fails "Bad Request"

If you try to cancel an order through this API you get a 400 Bad Request error

I managed to track it down to the payload that is being used to authenticate the request. This is used to generate headers for the request.

headers = self._auth_headers(path, method='DELETE', body=json_data)

In a delete request the variable json_data is empty. I believe this is why the headers fail. By setting the json_data value to "{}" (empty json) then it works

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.