Skip to content

Instantly share code, notes, and snippets.

@koheso
Created March 10, 2018 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koheso/0c25a44efb95b6399476bb6213901a45 to your computer and use it in GitHub Desktop.
Save koheso/0c25a44efb95b6399476bb6213901a45 to your computer and use it in GitHub Desktop.
CoinExchageでTicker情報取得
import requests
from pprint import pprint
def GetMarketAssetCode(marketID):
for data in coinIDInfoList:
if data["marketID"] == marketID:
return data["marketAssetCode"]
if __name__ == '__main__':
r = requests.get('https://www.coinexchange.io/api/v1/getmarkets')
json = r.json()
coinIDresults = json["result"]
coinIDInfoList = []
for data in coinIDresults:
coinIDInfo = {"marketID":data['MarketID'],"marketAssetCode":data['MarketAssetCode']}
coinIDInfoList.append(coinIDInfo)
r = requests.get('https://www.coinexchange.io/api/v1/getmarketsummaries')
json = r.json()
coinexchangeList = json["result"]
for data in coinexchangeList:
marketID = data['MarketID']
marketAssetCode = GetMarketAssetCode(marketID)
bidPrice = data['BidPrice']
askPrice = data['AskPrice']
print(marketAssetCode)
print("AskPrice:"+bidPrice)
print("BidPrice:"+askPrice)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment