Created
June 6, 2019 15:35
-
-
Save MtkN1/b5f71a07544dfe8aadb983f6806220fc to your computer and use it in GitHub Desktop.
gmocoiner usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from gmocoiner import GMOCoin | |
if __name__ == '__main__': | |
api_key = 'YOUR_API_KEY' | |
secret = 'YOUR_SECRET_KEY' | |
gmo = GMOCoin(api_key, secret, late_limit=True, logger=None) | |
# ティッカー情報を表示 | |
resp = gmo.ticker(symbol='BTC_JPY') | |
ticker = resp.json() | |
print(json.dumps(ticker, indent=2)) | |
# 資産残高を表示 | |
resp = gmo.account_assets() | |
print(json.dumps(resp.json(), indent=2)) | |
# 最寄買い気配地 - 5000の価格に買い指値 | |
buy = int(ticker['data'][0]['bid']) - 5000 | |
resp = gmo.order(symbol='BTC_JPY', side='BUY', | |
executionType='LIMIT', size='0.01', price=buy) | |
print(json.dumps(resp.json(), indent=2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment