This question is related to a trading exchange known as Poloniex.com where I m using their public api- https://poloniex.com/support/api/ especially the function of returnChartData using Python Wrapper.
I have a list with me and this list includes all the altcoins(Alternate coins) listed on Poloniex Something like this- Altcoins= ['BTC_ETH','BTC_ZEC','BTC_XMR','BTC_LTC','BTC_ETC','BTC_BTS','BTC_GNT','BTC_XRP','BTC_FCT','BTC_SC','BTC_DCR','BTC_DASH',.....] (It should have more than 80-100 Altcoins)
the returnChartData function when called returns the trading and pricing data for the particular currencypair for an interval ranging from 5 minutes to a week. So bascially it is Historical data api. I want to use there 4 Hour candle data (period=14400) which I wish to call every 4 hour for all the alt coins at once.
This is what I wish to do- 1. Use poloniex public api and call the historical data for all the altcoins (around 100) every 4 hours 2. Want to create variable of the name same of the altcoin so around 80-90 variables and 3. store data of a particular altcoin to its respective variable 4. Using Pandas DataFrame on all those variable and perform trading and analysis 5. Repeat process every 4 hours. (Offcourse i need not create variables again and again)
So is there any way that I use and run one or two loops every 4 hours to solve this issue or should I run individual 80-100 calculations individually?
Here from where the api is taken- https://github.com/s4w3d0ff/python-poloniex Here is the sample code for running 1 calculation at a time
from poloniex import Poloniex, Coach
import pandas as pd
myCoach = Coach()
public = Poloniex(coach=myCoach)
"""Below is the code for a single Altcoin. But I wish to perform the below process on the whole gamut"""
eth=public.returnChartData('BTC_ETH',period=14400) """Saving the data to a variable"""
eth=pd.DataFrame(eth)
The above code gives me what I want, but please understand how can I write same above piece for 100 altcoins and run them every 4 hours. What if i want to run it every 5 minutes. It will be cumbersome.
This is what I tried to solve the problem-
from poloniex import Poloniex, Coach
import pandas as pd
myCoach = Coach()
public = Poloniex(coach=myCoach)
coinlist=['BTC_ETH','BTC_ZEC','BTC_XMR','BTC_LTC','BTC_ETC','BTC_BTS','BTC_GNT','BTC_XRP','BTC_FCT','BTC_SC','BTC_DCR','BTC_DASH']
for i in coinlist:
altcoins=public.returnChartData(i,period=14400)
The above thing that I tried gives me data of the last altcoin in list and i.e. BTC_DASH. I think it overriding data till it reaches the end
Can you guys help out please