Closed Mantas779 closed 5 years ago
returnOrderBook
has the currencyPair
and depth
parameters, by default it will return all currencies at a depth of 20.
To get the BTC_ARDR orderbook at depth of 5:
orderbook = polo.returnOrderBook(currencyPair='BTC_ARDR', depth=5)
Works great , thx
Were can i find the possible settings. I am making a Tkinter price / arbitrage / trading monitor.
2017-07-25 17:10 GMT+02:00 s4w3d0ff notifications@github.com:
returnORderBook has the currencyPair and depth parameters, by default it will return all currencies at a depth of 20.
To get the BTC_ARDR orderbook at depth of 5:
orderbook = polo.returnOrderBook(currencyPair='BTC_ARDR', depth=5)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/s4w3d0ff/python-poloniex/issues/147#issuecomment-317769506, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ4TJugMfnr1CreYhqTxluXDYXob3hdPks5sRgV8gaJpZM4OiNlr .
-- Greetings Mantas
In the python console try:
import poloniex
help(poloniex.Poloniex)
All the possible api params should be covered, as long as they are documented here: https://poloniex.com/support/api
thx,
https://poloniex.com/support/api i know, but was not really clear for me
ill try the help ,
Gr.
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virusvrij. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
2017-07-25 20:24 GMT+02:00 s4w3d0ff notifications@github.com:
In the python console try:
import poloniex help(poloniex.Poloniex)
All the possible api params should be covered, as long as they are documented here: https://poloniex.com/support/api
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/s4w3d0ff/python-poloniex/issues/147#issuecomment-317825752, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ4TJtwECHPKl4nwUYrZKf9v3HJqvlK5ks5sRjLigaJpZM4OiNlr .
-- Greetings Mantas
hi,
sorry to bother you again. I came really far now, all my public api calls work in my tkinter app. But i dont get the private app working, whatever i try, i use Python 3.
The api keys work in other apps and polo website
This is my code, hope you can direct me again in the right direction.
Greetings, Mantas
from tkinter import * import tkinter as tk from poloniex import Poloniex import time
polo = Poloniex()
polo.APIKey = "XXX-XXX-XXX-XXX" polo.secret = "123456789"
now = polo.returnTicker()['BTC_ARDR']['last'] print(now)
bal = polo.returnBalances()['ARDR'] print(bal)
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virusvrij. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
2017-07-25 20:24 GMT+02:00 s4w3d0ff notifications@github.com:
In the python console try:
import poloniex help(poloniex.Poloniex)
All the possible api params should be covered, as long as they are documented here: https://poloniex.com/support/api
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/s4w3d0ff/python-poloniex/issues/147#issuecomment-317825752, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ4TJtwECHPKl4nwUYrZKf9v3HJqvlK5ks5sRjLigaJpZM4OiNlr .
-- Greetings Mantas
first off it seems you are using a different api wrapper, there is no PoloniexCredentialsException
.
You are going to want to uninstall whatever wrapper you have and install this one:
pip uninstall poloniex
# and/or
pip3 uninstall poloniex
pip install git+https://github.com/s4w3d0ff/python-poloniex.git
# or for python3
pip3 install git+https://github.com/s4w3d0ff/python-poloniex.git
Then to import your api key:
from poloniex import Poloniex
polo = Poloniex(key='API-KEY-124-NON-6465', secret='reallylongrecrethash346357457')
# or
polo.key = 'API-KEY-124-NON-6465'
polo.secret = 'reallylongrecrethash346357457'
Seems to work, thx,
import poloniex help(poloniex.Poloniex) gives also other help points now, makes more cense.
Now it asks for the :Nonce must be greater than 1451227900000027425. You provided 1501404669624338. Thought that would be arranged by the wrapper?
I changed the APIkey and secret, works now without error
Now i have to construct a Buy order, see if i can construct it.
from poloniex import Poloniex, Coach import datetime
polo = Poloniex() myCoach = Coach()
polo.Key = 'polo-key' polo.Secret = 'polo-secret'
polo.public = Poloniex(coach=myCoach) polo.private = Poloniex(polo.Key, polo.Secret, coach=myCoach)
print (datetime.datetime.now())
balance = polo.private.returnBalances() print("I have %s ARDR" % balance['ARDR'])
figured out the buy and sell order code got it : sellOrder = polo.private.sell(currencyPair= "BTC_DGB" , rate= 0.00009999, amount=500)
How do i get the returned ordernr / data , cant figure out the argument for data to fill in?
message = polo.private.handleReturned(data) print(message)
You can use one Poloniex object for both private and public commands if it has api keys
from poloniex import poloniex
polo = Poloniex(key, secret)
tick = polo.returnTicker()
print(tick['BTC_DASH'])
results = polo.buy(currencyPair='BTC_DASH', rate=0.06129990, amount=0.01450150)
results
will look something like this if the api request is successful:
> results
{'orderNumber': '109974601338',
'resultingTrades': [
{'type': 'buy',
'amount': '0.01450150',
'tradeID': '6990184',
'rate': '0.06129990',
'total': '0.00088894',
'date': '2017-07-31 13:07:05'}
]}
Ignore Poloniex.handleReturned
, it is used internally by the wrapper whenever you make an api call.
myCoach = Coach()
myKey = 'polo-key'
mySecret = 'polo-secret'
polo = Poloniex(myKey, mySecret, coach=myCoach)
If you want to keep private and public separate (which it looks like you are trying to do) try something like this:
from poloniex import Poloniex, Coach
poloApi = {}
myCoach = Coach()
myKey = 'polo-key'
mySecret = 'polo-secret'
poloApi['private'] = Poloniex(myKey, mySecret, coach=myCoach)
poloApi['public'] = Poloniex(coach=myCoach)
balance = poloApi['private'].returnBalances()
print("I have %s ARDR" % balance['ARDR'])
tick = poloApi['public'].returnTicker()['BTC_ARDR']
print(tick)
print(tick['last'])
thx,
i put myCoach = Coach(timeFrame=1.0, callLimit=6) in my program.
My problem is , i dont know how to print in IDLE for example, or show the results in my tkinter app.
I need the results , trade id ( ordernumber) for moving or deleting the order.
how do i handle the results? , i see they come back in a list, i just started to get out of them, with the nested lists.
orderbook = polo.returnOrderBook(currencyPair='BTC_ARDR', depth=1)['asks'][0][0] print(orderbook)
output: 0.00003779
can i do for example: results = polo.buy(currencyPair='BTC_DASH', rate= 0.06129990, amount=0.01450150) print(results)
2017-07-31 21:10 GMT+02:00 s4w3d0ff notifications@github.com:
You can use one Poloniex object for both private and public commands if it has api keys
from poloniex import poloniex polo = Poloniex(key, secret) tick = polo.returnTicker()print(tick['BTC_DASH']) results = polo.buy(currencyPair='BTC_DASH', rate=0.06129990, amount=0.01450150)
results will look something like this if the api request is successful:
results
{'orderNumber': '109974601338', 'resultingTrades': [ {'type': 'buy', 'amount': '0.01450150', 'tradeID': '6990184', 'rate': '0.06129990', 'total': '0.00088894', 'date': '2017-07-31 13:07:05'} ]}
Ignore Poloniex.handleReturned, it is used internally by the wrapper whenever you make an api call.
myCoach = Coach()
myKey = 'polo-key' mySecret = 'polo-secret'
polo = Poloniex(myKey, mySecret, coach=myCoach)
If you want to keep private and public separate (which it looks like you are trying to do) try something like this:
from poloniex import Poloniex, Coach
poloApi = {} myCoach = Coach()
myKey = 'polo-key' mySecret = 'polo-secret'
poloApi['private'] = Poloniex(myKey, mySecret, coach=myCoach) poloApi['public'] = Poloniex(coach=myCoach)
balance = poloApi['private'].returnBalances() print("I have %s ARDR" % balance['ARDR'])
tick = poloApi['public'].returnTicker()['BTC_ARDR'] print(tick) print(tick['last'])
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/s4w3d0ff/python-poloniex/issues/147#issuecomment-319160880, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ4TJgmzoxZUv2l0N-qlPMRNIFCx4omzks5sTiF3gaJpZM4OiNlr .
-- Greetings Mantas
print(results)
should show the order if api request is successful
{'orderNumber': '109974601338',
'resultingTrades': [
{'type': 'buy',
'amount': '0.01450150',
'tradeID': '6990184',
'rate': '0.06129990',
'total': '0.00088894',
'date': '2017-07-31 13:07:05'}
]}
My app is working, thx to you. Now i have to style it and implement the algo strategy's
1 strange thing is that when i activate the moveOrder function. without any of the conditions is True, the ordernumber updates after (11000) And also after the order is moved.
without the MoveOrder fuction, the ordernumber stays the same.
Anyone experienced this? Anyone interested in my code, let me know.
If I understand correctly, you are saying that moveOrder
changes the orderNumber for the order moved?
I would expect this to be normal, when you use moveOrder
poloniex will cancel the order what is being moved and place a new order, returning the new orderNumber (if successful).
TKinter TRading bot is running, buying smartly. THX for the great work with the wrapper. now have to delete the orders
now i get a this error.
raise PoloniexError(out['error']) poloniex.PoloniexError: Invalid order number, or you are not the person who placed the order.
I use : 9 sec .after option to rerun the APi for info
from the returnOpenOrders(currencypair=coin) on = (item["orderNumber"])
def cancel_order(self): polo.private.cancelOrder(orderNumber=on)
I'm not sure, maybe the order was filled before it could be canceled?
I dont get it with a normal order that is not moved.
What kind of program most people use for the poloniex trading app?
Command prompt , tkinter or something else? Tkinter is extremely slow, because of my .after 9000 to constantly ask for new data.
All the tools I use are here: https://github.com/s4w3d0ff/marconibot
I haven't written docs on how to use it yet but there are a lot of useful tools, and the bot that I have currently running (now for a consistent 24 hours without hiccups) is making profitable trades.
But you will have to know a bit about scikit-learn
and pandas
to use and it is only written for basic command line use at the moment. It has basic(ly crappy) bokeh
support as well.
But like I said it isn't documented very well so it will involve a bit of code reading as well as trial and error.
Now that I have my bot tuned(ish) and working, I have begun to work on the docs.
Thx, will take a look,
Want to see how python runs on command line.
My app is also starting to make profitable trades. Really hard to get the right algorithm .
I need to figure out some Tkinter , settings from entry field , to use in the app.
2017-08-19 0:48 GMT+02:00 s4w3d0ff notifications@github.com:
All the tools I use are here: https://github.com/s4w3d0ff/marconibot
I haven't written docs on how to use it yet but there are a lot of useful tools, and the bot that I have currently running (now for a consistent 24 hours without hiccups) is making profitable trades.
But you will have to know a bit about scikit-learn and pandas to use and it is only written for basic command line use at the moment. It has basic(ly crappy) bokeh support as well.
But like I said it isn't documented very well so it will involve a bit of code reading as well as trial and error.
Now that I have my bot tuned(ish) and working, I have begun to work on the docs.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/s4w3d0ff/python-poloniex/issues/147#issuecomment-323477322, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ4TJgO-5ybjx8cUJzRbFJLB-GO1MXLXks5sZhSogaJpZM4OiNlr .
-- Greetings Mantas
Which is the function to get the error messages from POLO, like the retry, or wrong ordernumber message. Want to show them in a text field in Tkinter
This wrapper has 2 custom exceptions: PoloniexError
and RetryException
The RetryException
is a child of PoloniexError
so if you want to capture both you can just capture the PoloniexError
and it will also capture RetryExceptions
import poloniex
polo = Poloniex()
try:
polo.returnTicker()
except poloniex.PoloniexError as e:
print(e)
Error messages returned from poloniex (in json) are automatically captured and the error messages are raised with PoloniexError
. If the error message is connection related (and poloniex asks 'please try again' in the error message) a 'RequestException' is raised (which is then captured by the _retry decorator, and the api call is tried again).
Wich program you guys use to make a executable? I tried Pyinstaller and py2exe but failed, couldn't find a lot of dependencies.
I lately getting a lot of these errors, didnt make more calls then normal even put the Calls every 10 sec Then the app crashes, is it a error call from the wrapper / coach or Poloniex itself and who is terminating the connection.? My Coach setting : myCoach = Coach(timeFrame=1.0, callLimit=6)
Sometimes it goes for hours without a error.
The max 6 calls are they per IP adres or , per acc ( api Key) ?
File "C:\Users\Mantas779\AppData\Local\Programs\Python\Python35-32\lib\site-packages\poloniex__init__.py", line 270, in handleReturned raise PoloniexError(out['error']) poloniex.PoloniexError: Please do not make more than 8 API calls per second.
I have also been seeing these errors, my bots code has not changed but it seems that poloniex is changing things on their end (on a live api... Instead of working on a whole new version then phasing out the old one). Perhaps my code is indeed sending too many requests per second, but seeing that I have 1 sec waits throughout my bots code, I really doubt it is going over the limit. It wasn't before, now it is with no changes on my end.
I don't see why they keep doing this. Everytime poloniex makes a tweak on the api most bots go down, which hurts poloniex's trade volume. It's like shooting yourself in the foot then learning nothing from the experiance and promptly doing it again. Sorry about the rant but poloniex needs to get their shit together or roll out a new api (that works as advertised and isn't constantly changing without warning).
It should be 6 calls per second per ip address.
Yes , i think also per IP adres, my bot has two functions: 1 call every 8 sec and 1 every 11 sec. Now i updated my bot, with the Coach settings, it seems to go well now.
But when i start another bot on a diff API key on the same IP adres, i am disconnected, for more then 8 calls. I am testing now with 1 bot. Also sometimes i get: invalid order number.
BTW: i notice now how many bots are gone, for example DASH volume collapsed!
Last 2 days no problem, with to much API calls, runned 1 instance, with updated program settings. Dont see much bots around anymore, Polo is fast now !
Now i will start to test with:
You can set the call limit of a coach and use that coach across other Poloniex instances like this:
from poloniex import Poloniex, Coach
myCoach = Coach(timeFrame=1.0, callLimit=6)
polo = Poloniex(key, secret, coach=myCoach)
polo.coach = myCoach
polo2 = Poloniex(coach=myCoach)
orderbook =polo.returnOrderBook()['BTC_ARDR']
Works, but get the whole orderBook, how can i give it the parameter &depth=5 which is supported by poloniex.