[quoine liquid bot] products

ここを見る人は、pythonやAPIに詳しくないと思われるので丁寧に注釈をつけました

HTTP API を 先ずは画面で確認します、ブラウザのアドレスバーにこのアドレスを入れてエンターすればOK

リンクとして貼っときます

The page you were looking for doesn't exist (404)

表示された画面

中を確認します

{"id":"5","product_type":"CurrencyPair","code":"CASH","name":" CASH Trading","market_ask":5428189.0,"market_bid":5425335.0,"indicator":-1,"currency":"JPY","currency_pair_code":"BTCJPY","symbol":"¥","btc_minimum_withdraw":null,"fiat_minimum_withdraw":null,"pusher_channel":"product_cash_btcjpy_5","taker_fee":"0.003","maker_fee":"0.0","low_market_bid":"5229400.0","high_market_ask":"5554577.0","volume_24h":"2750.3165501","last_price_24h":"5251266.0","last_traded_price":"5428189.0","last_traded_quantity":"0.001","average_price":"5430011.87167","quoted_currency":"JPY","base_currency":"BTC","tick_size":"1.0","disabled":false,"margin_enabled":true,"cfd_enabled":true,"perpetual_enabled":false,"last_event_timestamp":"1615147393.422","timestamp":"1615147393.422","multiplier_up":"1.4","multiplier_down":"0.6","average_time_interval":300,"progressive_tier_eligible":true,"exchange_rate":0}

取引所の現在のBTCJPYの情報です ビットコインが日本円でいくらかということですが、実態はCASH と JPYの対比になってます

CASHはLiquidが内部的に使っている単位のようです。コインとして販売もしています 

上記アドレスは末尾の番号が5だったので、1から順に変更して見てみます

https://api.liquid.com/products/1

プロダクツNO.1はBTCUSD

{"id":"1","product_type":"CurrencyPair","code":"CASH","name":" CASH Trading","market_ask":49870.61,"market_bid":49833.4,"indicator":1,"currency":"USD","currency_pair_code":"BTCUSD"・・・・
https://api.liquid.com/products/3

“name”:” CASH” “currency”:”EUR” “currency_pair_code”:”BTCEUR

ユーロ対BTCです

https://api.liquid.com/products/7
7 "currency_pair_code":"BTCSGD" シンガポールドル
9 "currency_pair_code":"BTCHKD" 香港ドル

13 “currency_pair_code”:”BTCAUD” オーストリアドル

以降は20まで調べたが該当なし

次はパイソンで表示してみます

from pprint import pprint #1
import requests #2
import json #3
res = requests.get('https://api.liquid.com/products/5') #4
data = json.loads(res.text) #5
pprint(data) #6

#の注釈

  1. pythonモジュール、横一列のデータを見やすく改行して表示してくれる
  2. web上のデータ送受信サービスを受けるためのモジュール
  3. WEBのデータやり取りするフォーマット、テキストをカンマなどの記号で区切ったもの
  4. Liquidのデータを渡す専用のアドレスを呼び出す
  5. 返ってきたたJsonデータを只のテキストに変換して、dataという変数に入れる
  6. dataという変数に格納された内容を、整形して表示する

見慣れない単語は必要になったらその都度ググるしかない、とりあえずはスルーでOK

{'average_price': '5421017.65184',
 'average_time_interval': 300,
 'base_currency': 'BTC',
 'btc_minimum_withdraw': None,
 'cfd_enabled': True,
 'code': 'CASH',
 'currency': 'JPY',
 'currency_pair_code': 'BTCJPY',
 'disabled': False,
 'exchange_rate': 0,
 'fiat_minimum_withdraw': None,
 'high_market_ask': '5554577.0',
 'id': '5',
 'indicator': -1,
 'last_event_timestamp': '1615151103.584584592',
 'last_price_24h': '5261300.0',
 'last_traded_price': '5417760.0',
 'last_traded_quantity': '0.001',
 'low_market_bid': '5229400.0',
 'maker_fee': '0.0',
 'margin_enabled': True,
 'market_ask': 5417082.0,
 'market_bid': 5416950.0,
 'multiplier_down': '0.6',
 'multiplier_up': '1.4',
 'name': ' CASH Trading',
 'perpetual_enabled': False,
 'product_type': 'CurrencyPair',
 'progressive_tier_eligible': True,
 'pusher_channel': 'product_cash_btcjpy_5',
 'quoted_currency': 'JPY',
 'symbol': '¥',
 'taker_fee': '0.003',
 'tick_size': '1.0',
 'timestamp': '1615151103.584584592',
 'volume_24h': '2757.23616322'}

コメント

タイトルとURLをコピーしました