Code Monkey home page Code Monkey logo

btcde's People

Contributors

ajascha avatar cj4c0b1 avatar com8 avatar froseppl avatar ghgh2 avatar harryeuro avatar js931 avatar limlug avatar peshay avatar pmatos avatar wwender 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btcde's Issues

Add tests for float vs decimal

As there are differences between float and decimal calculation, a test should be added which would have an incorrect calculation only for floats.

showMyTrades returns nothing

Hi,

if i try to retrieve the trades i made, the function "showMyTrades" just returns an empty response. There are many trades in my account and all other functions work fine. So it is not a problem with my account or API keys.

My code:

import btcde
api_key_BTCDE = '[my key]'
api_secret_BTCDE = '[my secret]'
conn = btcde.Connection(api_key_BTCDE, api_secret_BTCDE)
trades = conn.showMyTrades() 
print(trades)

The response:

{'trades': [], 'page': {'current': 0, 'last': 0}, 'errors': [], 'credits': 57}

Any help will be greatly appreciated, thanks!

Best regards
Jan

unable to buy and sell something

According to your example I tried to sell something with this codesnippet

import btcde
create a object for the connection settings
api_key = "my_key"
api_secret = "my_secret"
conn = btcde.Connection(api_key, api_secret)
orderbook = conn.showOrderbook('sell', 'btceur')
print('API Credits Left: ' + str(orderbook.get('credits')))
orders = orderbook.get('orders')

for order in orders:
    print('Order ID: ' + str(order.get('order_id')) + " Min_Amount: " + str(order.get('min_amount')) + '\tPrice: ' + str(order.get('price')) + ' EUR')

conn.executeTrade('NRRHV9','sell','btceur',0.0021)`

Unfortunally it doesn't work for me. I get this output.


WARNING:btcde:API Error Code: 5
WARNING:btcde:API Error Message: Invalid signature
WARNING:btcde:API Error URL: https://api.bitcoin.de/v2/trades/NRRHV9?order_id=NRRHV9&type=sell&trading_pair=btceur&amount=0.0021

Would be great if you could fix this?

upgrade to api version 4

At the moment the code handels with bitcoin.de api version 2, bitcoin.de upgraded the api version to 4. It would be nice if you could enhance your code in order to deal with version 4.

Invalid STATES check

According to the bitcoin.de API documentation, the valid states for orders are [-2, -1, 0], however the btcde interface only accepts the states [-1, 0, 1], which is only correct for showMyTrades, not showMyOrders! Please fix this, thanks.

Problem with executeTrade

Hi,
thank for creating this library.
I found an issue with executeTrade()
A normal trade execution works perfectly.
But a python error will be raised if there is a problem like 'order id does not exist' or 'order not possible'.
The reason is that the API also responds with http status codes 403, 404, 422
I have added these codes to HandleAPIErrors(), this works for me.
But i am not sure if this is the correct solution.
Frank

make it possible to throw API errors

Currently API errors (such as insufficient credits) are catched internally and the response is simply empty. It would be nice if the SDK could also have an option to throw the api errors instead, such that the superscript can handle them accordingly eg by limiting the rate.

Executing a trade (buy) fails

The call
btcde.executeTrade(conn, order, "btceur", "buy", amount)
fails with the following output:

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.bitcoin.de
DEBUG:urllib3.connectionpool:https://api.bitcoin.de:443 "POST /v2/trades/F96DZZ?amount=0.02&order_id=F96DZZ&trading_pair=buy&type=btceur HTTP/1.1" 400 None
Code:     28
Message:  Forbidden value for POST-Parameter: type
With URL: https://api.bitcoin.de/v2/trades/F96DZZ?amount=0.02&order_id=F96DZZ&trading_pair=buy&type=btceur
{}

Suspecting that it has to do with the decimal dot in the float, I tried to pass in the amount as a string (with decimal comma). Didn't help, but the error is a different one:

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.bitcoin.de
DEBUG:urllib3.connectionpool:https://api.bitcoin.de:443 "POST /v2/trades/F96DZZ?amount=0,02&order_id=F96DZZ&trading_pair=buy&type=btceur HTTP/1.1" 400 None
Code:     5
Message:  Invalid signature
With URL: https://api.bitcoin.de/v2/trades/F96DZZ?amount=0,02&order_id=F96DZZ&trading_pair=buy&type=btceur
{}

Didn't try with integer amount (too expensive ;-)

Thanks for looking into this. Andreas

Please help me to understand the **args

Hello, can you give me same example for the **args ?

showOrderbook(OrderType, trading_pair, **args)

how i had to write only_express_orders in a **args ?

Please more samples :-)

Trying to execute expired trade leads to decoding error

After a call to executeTrade(...) where order had already expired, I get the following output:

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.bitcoin.de
DEBUG:urllib3.connectionpool:https://api.bitcoin.de:443 "POST /v2/trades/F96DZZ?amount=0.02&order_id=F96DZZ&trading_pair=btceur&type=buy HTTP/1.1" 403 None
Traceback (most recent call last):
  File "buy.py", line 50, in <module>
    pprint(btcde.executeTrade(conn, order, "buy", "btceur", amount))
  File "/home/andreas/python/btcde/btcde.py", line 174, in executeTrade
    return APIConnect(conn, 'POST', params, newuri)
  File "/home/andreas/python/btcde/btcde.py", line 121, in APIConnect
    if HandleAPIErrors(r):
  File "/home/andreas/python/btcde/btcde.py", line 61, in HandleAPIErrors
    content = json.load(reader(r.raw))
  File "/usr/lib/python2.7/json/__init__.py", line 287, in load
    return loads(fp.read(),
  File "/usr/lib/python2.7/codecs.py", line 492, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte

Don't understand this, it doesn't look helpful.
Vielen Dank & liebe Grüße, Andreas

showAccountLedger: Date arguments don't work

It doesn't matter if i pass a date argument (date_start / date_end) or not, the function always returns the default, which is the account ledger for the last 10 days.

Example code:
ledger = conn.showAccountLedger(currency="eth", date_start="2018-01-01T01:00:00+01:00", date_end="2018-01-07T01:00:00+01:00")

Delete und andere Order Requests funktionieren nicht

Hallo Zusammen,

damit werden schon einige Probleme gehabt haben aber trotz diskussion im Forum hat wohl keine hier was zum Code geändert. Die Parameter mit dem ":" sind so nicht richtig angegeben.

Bei delete sollte das richtig so aussehen:

def deleteOrder(conn, order_id):
"""Delete an Order."""
#newuri = orderuri + ":" + order_id KEIN DOPPELPUNKT ABER SLASH
newuri = orderuri + "/" + order_id
params = {'order_id': order_id}
return APIConnect(conn, 'DELETE', params, newuri)

Bei my order Details so:
def showMyOrderDetails(conn, order_id):
"""Details to an own Order."""
#newuri = orderuri + '/:' + order_id KEIN DOPPELPUNKT!
newuri = orderuri + '/' + order_id
params = {'order_id': order_id}
return APIConnect(conn, 'GET', params, newuri)

=> Die anderen calls müsste man dann paralell ändern. Bei den beiden kann ich es aber mit Sicherheit bestätigen, da ich die so getestet haben.
Viele Grüße und Danke für die Sourcen :)

NameError: global name 'method' is not defined

Dear all,

I was very happy to discover this module, which I am quite eager to try out.
Thanks a lot for writing and making it available!

But my first attempt failed. I followed the steps in the README.md up to this point:

>>> orderbook = btcde.showOrderbook(conn, 'buy')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "btcde.py", line 137, in showOrderbook
    return APIConnect(conn, 'GET', params, orderuri)
  File "btcde.py", line 115, in APIConnect
    header = set_header(url)
  File "btcde.py", line 84, in set_header
    if method == 'POST':
NameError: global name 'method' is not defined

Looks manageable, but I thought you might want to know about this.

Best regards from Luxembourg,
Andreas

Invalid signature

createOrder always throws 'invalid signature'. I am not sure if its me or there is a bug but most of the other methods just work, so does createOrder in an older Version.

Not working with python 2.7 because of http.client

Hi,
the code in btcede.py line 17,18 need to differ between python 2.7 and 3.
Doc of httplib says "The httplib module has been renamed to http.client in Python 3".
In case of version < 3 the lib is called httplib else http.client
Rgds
jammcc

Add maintenance handling

If API send maintenance information, it should be saved and queries paused, during maintenance period.

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.