Coder Social home page Coder Social logo

btce-api's People

Contributors

alanmcintyre avatar area avatar christopherpoole avatar codemonkey2841 avatar codereclaimers avatar frenchfriesketchup avatar g4nd41ph avatar hiyorimi avatar jazzer9f avatar jluttine avatar kishkin avatar lomax avatar wk8 avatar zku 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  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

btce-api's Issues

scrapeMainPage().messages updates slowly

I'm not sure what's going on here, but when I scrape the main page for messages I get the same results over and over for about 4 or 5 minutes.

I suspect this is actually a bug in btc-e, related to what sometimes happens if you switch currencies just as a new message shows up, and it disappears.

Exception Caused by nonce error

I'm getting an error that is causing an unusual exception when it automatically tries to fix a nonce error. I think the error message was changed and it cannot parse this line (164) properly:

expected, actual = map(int, err_message.split()[-2:])

The error messages from btce look like this:
invalid nonce parameter; on key:xxxxx, you sent:xxxxx

python-3 compatibility

/btceapi/common.py line 49 is not compatible with exceptions in python-3
I think it should change to:
except Exception as e:
print("Error while attempting to parse JSON response:", e)
print ("Response:",response)
raise e

Trade response parsing error

There seems to be issues with parsing the json response received on higher/certain trade calls. It appears to be that the error occurs in the "remains" field as there's no numbers trailing the the decimal point (in this case the order was 44.000000).

Error while attempting to parse JSON response: Expecting , delimiter: line 1 column 48 (char 48)
Response: '{"success":1,"return":{"received":0,"remains":44.,"order_id":(omitted),"funds":{"usd":778.21537223,"rur":0,"eur":0,"btc":0,"ltc":0.43376503,"nmc":0,"nvc":0,"trc":0,"ppc":0}}}'

I guess it's an issue on BTC-E's part, but perhaps you can handle it accordingly in your API. Otherwise I've enjoyed working with it thus far.

XPM-BTC

Hello, Alan. Please add XPM-BTC pair.

Small bug in Common.py

Hey there, I noticed that sometimes an automated trader I built was bombing out when trying to make trades involving the btc_eur pair with a message about not being able to use a "none type" (I suppose that's Python's version of a null reference exception). In any case, I traced it to the fact that there is no minimum trade or max digits value set for that pair in Common.py. After adding appropriate values for these, I didn't see the error again. Please merge this change into the master if you feel it appropriate.

CNH

Hey, Alan. Recently BTC-e has added CNH for BTC, LTC and USD. Please add these pairs.

Add order validation

Provide functions to validate an order before submitting it, to catch things like orders that are below the minimum size, etc., without having to make the trip to the server to find out.

decimal_places shouldn't be applied to amount

Pair's decimal_places are really about rate. Amount, as long as it's greater than the minimum, can have up to 8 decimal places regardless the pair and currency (at least in Trade method parameter and result set, but I suspect it applies everywhere). Enforcing 8 decimal places in parameter values ARE important, 9 or more places are rejected.

I failed to find a reference to 8-digit amount precision in the documentation -- maybe some other libraries have it, as there are obviously many bots buying and selling amounts like 0.01003882 BTC.

Looking at the code, I'd suggest that format_currency should be split in format_rate and format_amount (the latter doesn't really need pair information, so it's unclear in what class should in be defined). For existing code calling format_currency, it should probably be treated like format_rate to be on the safe side. Maybe I'll have some time to prepare a complete patch.

Attempt to fix outdated nonce

The API returns an error message that makes it possible to correct an outdated nonce (due to an application crash without saving nonces, for example), so it would be helpful to just fix it and retry the call.

Add parameters to getTradeHistory and getDepth

It will be great if it will be possible to call getTradeHistory and getDepth functions with additional parameters. For example, I need to get just single last trade and not the whole 150, because of decreased response time and BTC-e server load. For this reason the API allows to specify, for example, optional count parameter, so it would be great if you will implement this feature in the future.

Redundant nonce management

You could simply build a nonce method based on time, lets say:

    # This value is used in order to generate a small nonce, 
    # because for some reason btc-e doesn't like big nonces.
    timestamp_reduce_value = 1380736931200
    return int(time.time()*1e3) - timestamp_reduce_value

common.formatCurrency bug?

Hi.
When making an order for sale, for example:
tapi.trade("btc_usd", "sell", 999.99, 0.109)

order for sale 0.108 btc created. It's just me or there is a bug in common.formatCurrency?

Scraper doesn't seem to handle &apos and truncates strings

Example raw html:

<p id='msg10560425' class='chatmessage'>
<a title='30.12.13 21:43:11' style='color: #8da0b9; font-weight: bold;' 
href='javascript:void(0)' onclick='nChatMenu(88862, "andreasjva", 10560425, event)'>
andreasjva</a>: 
<span>1cryptoamin, just keep in mind, if you did 2% a day every day, at the end of the month you&apos;ll be up over 60% (compounded)</span>
</p>

as parsed by handle_data (html entity is changed to 0x0a):
1cryptoamin, just keep in mind, if you did 2% a day every day, at the end of the month you
ll be up over 60% (compounded)

After data.strip():
2013-12-30 21:43:11 andreasjva: ll be up over 60% (compounded)

BTW -- it's possible there are other html entity issues.

'order' parameter of 'transHistory' not works

At first thank you for creating such a beautiful tool.
The issue is as follows: the order parameter of transHistory method of TradeAPI object does not do any sorting. As a workaround, I'm using a lambda function, but it may be a bit slower:

trn_history = t.transHistory(count_number=3) 
trn_history.sort(key=lambda a: a.transaction_id, reverse=True)
for n in trn_history:
    print "AMNT: %s\t CUR: %s\t DESC: %s\t STAT: %s\t TIM: %s\t TID: %s\t TYP: %s" % (n.amount, n.currency, n.desc, n.status, n.timestamp, n.transaction_id, n.type)

Also, I noticed, that the next TransactionHistoryItem objects aren't returned at all: currency, desc and status. transHistory always return them as None. It would be great if you'll fix this minor bug.

Best way to get around polling failure

HI Alan,

This isn't an issue with your excellent api (or at least I haven't seen it), but what's the best way to capture exceptions and retry polling when you get 403 and SSL Errors?

Right now my bot is running on a batch file (in infinite loop) so python script can restart when any exceptions are caught.

I'm new to github and haven't figured out how to email you. :(

EUR/RUR is not recognized

trying to do this
pair = "eur_rur"
gives this error
btceapi.common.InvalidTradePairException: Unrecognized pair: 'eur_rur'
An error occurred: Unrecognized pair: 'eur_rur'

withdraw coins

Hi alan, thank you for the great work.

Is it possible to withdraw coins via API? Apparently from the flag in the permission it is.. but how?

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.