Bittrex_Markets = requests.get("https://api.bittrex.com/api/v1.1/public/getmarkets").json()
Print (Bittrex_Markets)
>>>
{'success': True, 'message': '', 'result': [{'MarketCurrency': 'LTC', 'BaseCurrency': 'BTC', 'MarketCurrencyLong': 'Litecoin', 'BaseCurrencyLong': 'Bitcoin', 'MinTradeSize': 0.01686767, 'MarketName': 'BTC-LTC', 'IsActive': True, 'IsRestricted': False, 'Created': '2014-02-13T00:00:00', 'Notice': None, 'IsSponsored': None, 'LogoUrl': 'https://bittrexblobstorage.blob.core.windows.net/public/6defbc41-582d-47a6-bb2e-d0fa88663524.png'}, {'MarketCurrency': 'DOGE', 'BaseCurrency': 'BTC', 'MarketCurrencyLong': 'Dogecoin', 'BaseCurrencyLong': 'Bitcoin', 'MinTradeSize': 480.76923077, 'MarketName': 'BTC-DOGE', 'IsActive': True, 'IsRestricted': False, 'Created': '2014-02-13T00:00:00', 'Notice': None, 'IsSponsored': None, 'LogoUrl': 'https://bittrexblobstorage.blob.core.windows.net/public/a2b8eaee-2905-4478-a7a0-246f212c64c6.png'}, {'MarketCurrency': 'VDX', 'BaseCurrency': 'ETH', 'MarketCurrencyLong': 'Vodi X', 'BaseCurrencyLong': 'Ethereum', 'MinTradeSize': 300.0, 'MarketName': 'ETH-VDX', 'IsActive': True, 'IsRestricted': True, 'Created': '2019-05-23T00:41:32.987', 'Notice': None, 'IsSponsored': None, 'LogoUrl': 'https://bittrexblobstorage.blob.core.windows.net/public/3277e3cb-fe62-46df-9162-3d9ba67c521e.png'}]}
Bittrex_Get_Market_Summaries = requests.get("https://api.bittrex.com/api/v1.1/public/getmarketsummaries").json()
Print (Bittrex_Get_Market_Summaries)
>>>
{'success': True, 'message': '', 'result': [{'MarketName': 'BTC-DYN', 'High': 1.657e-05, 'Low': 1.437e-05, 'Volume': 83445.47466841, 'Last': 1.468e-05, 'BaseVolume': 1.27935571, 'TimeStamp': '2019-05-28T07:18:48.797', 'Bid': 1.437e-05, 'Ask': 1.461e-05, 'OpenBuyOrders': 42, 'OpenSellOrders': 738, 'PrevDay': 1.445e-05, 'Created': '2017-03-23T00:10:19.403'}, {'MarketName': 'USD-USDT', 'High': 1.009, 'Low': 1.00095, 'Volume': 283483.08497639, 'Last': 1.005, 'BaseVolume': 284948.3504794, 'TimeStamp': '2019-05-28T07:18:48.797', 'Bid': 1.002, 'Ask': 1.00481, 'OpenBuyOrders': 162, 'OpenSellOrders': 97, 'PrevDay': 1.00899, 'Created': '2018-05-31T13:27:08.477'}]}
Bittrex_Mrkt_0 = ((Bittrex_Markets)['result'][0])
Print (Bittrex_Mrkt_0)
>>>
{'MarketCurrency': 'LTC', 'BaseCurrency': 'BTC', 'MarketCurrencyLong': 'Litecoin', 'BaseCurrencyLong': 'Bitcoin', 'MinTradeSize': 0.01686767, 'MarketName': 'BTC-LTC', 'IsActive': True, 'IsRestricted': False, 'Created': '2014-02-13T00:00:00', 'Notice': None, 'IsSponsored': None, 'LogoUrl': 'https://bittrexblobstorage.blob.core.windows.net/public/6defbc41-582d-47a6-bb2e-d0fa88663524.png'}
Bittrex_Mrkt_Summary_0 = ((Bittrex_Get_Market_Summaries)['result'][0])
Print (Bittrex_Mrkt_Summary_0)
>>>
{'MarketName': 'BTC-DYN', 'High': 1.657e-05, 'Low': 1.437e-05, 'Volume': 83445.47466841, 'Last': 1.468e-05, 'BaseVolume': 1.27935571, 'TimeStamp': '2019-05-28T07:18:48.797', 'Bid': 1.437e-05, 'Ask': 1.461e-05, 'OpenBuyOrders': 42, 'OpenSellOrders': 738, 'PrevDay': 1.445e-05, 'Created': '2017-03-23T00:10:19.403'}
if ((Bittrex_Mrkt_0)['IsActive']) == True:
if ((Bittrex_Mrkt_0['IsRestricted'])) == False:
THEN HERE:
I need to return a dictionary from the list of dictionaries in Bittrex_Get_Market_Summaries, and I need to find that dictionary not by its index value but by it containing a 'MarketName': key value.
('\''+(Bittrex_Mrkt_0)['BaseCurrency']+'-'+(Bittrex_Mrkt_0)['MarketCurrency']+'\'')
'BTC-LTC'
That could be inserted after 'MarketName': but I don't know what to do beyond that. I'm still very new to Python. Maybe a for loop is what I'm looking for here?
In other words: I need information from BOTH of those links.
The first link gives the Active True/False and IsRestricted True/False information to the if statements.
Based on that, the Bid and Ask values are going to be pulled next for the same BTC-LTC pair.
So I can't go by the index in the list since they are totally different and will always possibly change.
I have to use 'BTC-LTC' as a way to search the second list of dictionaires, NOT the index.
Print (Bittrex_Markets)
>>>
{'success': True, 'message': '', 'result': [{'MarketCurrency': 'LTC', 'BaseCurrency': 'BTC', 'MarketCurrencyLong': 'Litecoin', 'BaseCurrencyLong': 'Bitcoin', 'MinTradeSize': 0.01686767, 'MarketName': 'BTC-LTC', 'IsActive': True, 'IsRestricted': False, 'Created': '2014-02-13T00:00:00', 'Notice': None, 'IsSponsored': None, 'LogoUrl': 'https://bittrexblobstorage.blob.core.windows.net/public/6defbc41-582d-47a6-bb2e-d0fa88663524.png'}, {'MarketCurrency': 'DOGE', 'BaseCurrency': 'BTC', 'MarketCurrencyLong': 'Dogecoin', 'BaseCurrencyLong': 'Bitcoin', 'MinTradeSize': 480.76923077, 'MarketName': 'BTC-DOGE', 'IsActive': True, 'IsRestricted': False, 'Created': '2014-02-13T00:00:00', 'Notice': None, 'IsSponsored': None, 'LogoUrl': 'https://bittrexblobstorage.blob.core.windows.net/public/a2b8eaee-2905-4478-a7a0-246f212c64c6.png'}, {'MarketCurrency': 'VDX', 'BaseCurrency': 'ETH', 'MarketCurrencyLong': 'Vodi X', 'BaseCurrencyLong': 'Ethereum', 'MinTradeSize': 300.0, 'MarketName': 'ETH-VDX', 'IsActive': True, 'IsRestricted': True, 'Created': '2019-05-23T00:41:32.987', 'Notice': None, 'IsSponsored': None, 'LogoUrl': 'https://bittrexblobstorage.blob.core.windows.net/public/3277e3cb-fe62-46df-9162-3d9ba67c521e.png'}]}
Bittrex_Get_Market_Summaries = requests.get("https://api.bittrex.com/api/v1.1/public/getmarketsummaries").json()
Print (Bittrex_Get_Market_Summaries)
>>>
{'success': True, 'message': '', 'result': [{'MarketName': 'BTC-DYN', 'High': 1.657e-05, 'Low': 1.437e-05, 'Volume': 83445.47466841, 'Last': 1.468e-05, 'BaseVolume': 1.27935571, 'TimeStamp': '2019-05-28T07:18:48.797', 'Bid': 1.437e-05, 'Ask': 1.461e-05, 'OpenBuyOrders': 42, 'OpenSellOrders': 738, 'PrevDay': 1.445e-05, 'Created': '2017-03-23T00:10:19.403'}, {'MarketName': 'USD-USDT', 'High': 1.009, 'Low': 1.00095, 'Volume': 283483.08497639, 'Last': 1.005, 'BaseVolume': 284948.3504794, 'TimeStamp': '2019-05-28T07:18:48.797', 'Bid': 1.002, 'Ask': 1.00481, 'OpenBuyOrders': 162, 'OpenSellOrders': 97, 'PrevDay': 1.00899, 'Created': '2018-05-31T13:27:08.477'}]}
Bittrex_Mrkt_0 = ((Bittrex_Markets)['result'][0])
Print (Bittrex_Mrkt_0)
>>>
{'MarketCurrency': 'LTC', 'BaseCurrency': 'BTC', 'MarketCurrencyLong': 'Litecoin', 'BaseCurrencyLong': 'Bitcoin', 'MinTradeSize': 0.01686767, 'MarketName': 'BTC-LTC', 'IsActive': True, 'IsRestricted': False, 'Created': '2014-02-13T00:00:00', 'Notice': None, 'IsSponsored': None, 'LogoUrl': 'https://bittrexblobstorage.blob.core.windows.net/public/6defbc41-582d-47a6-bb2e-d0fa88663524.png'}
Bittrex_Mrkt_Summary_0 = ((Bittrex_Get_Market_Summaries)['result'][0])
Print (Bittrex_Mrkt_Summary_0)
>>>
{'MarketName': 'BTC-DYN', 'High': 1.657e-05, 'Low': 1.437e-05, 'Volume': 83445.47466841, 'Last': 1.468e-05, 'BaseVolume': 1.27935571, 'TimeStamp': '2019-05-28T07:18:48.797', 'Bid': 1.437e-05, 'Ask': 1.461e-05, 'OpenBuyOrders': 42, 'OpenSellOrders': 738, 'PrevDay': 1.445e-05, 'Created': '2017-03-23T00:10:19.403'}
if ((Bittrex_Mrkt_0)['IsActive']) == True:
if ((Bittrex_Mrkt_0['IsRestricted'])) == False:
THEN HERE:
I need to return a dictionary from the list of dictionaries in Bittrex_Get_Market_Summaries, and I need to find that dictionary not by its index value but by it containing a 'MarketName': key value.
('\''+(Bittrex_Mrkt_0)['BaseCurrency']+'-'+(Bittrex_Mrkt_0)['MarketCurrency']+'\'')
'BTC-LTC'
That could be inserted after 'MarketName': but I don't know what to do beyond that. I'm still very new to Python. Maybe a for loop is what I'm looking for here?
In other words: I need information from BOTH of those links.
The first link gives the Active True/False and IsRestricted True/False information to the if statements.
Based on that, the Bid and Ask values are going to be pulled next for the same BTC-LTC pair.
So I can't go by the index in the list since they are totally different and will always possibly change.
I have to use 'BTC-LTC' as a way to search the second list of dictionaires, NOT the index.