Create a gist now

Instantly share code, notes, and snippets.

@juiCYMod /soneki.py
Last active Mar 16, 2018

What would you like to do?
ZaifのAirFXの指定した範囲の損益をCSVで出力
from zaifapi import ZaifLeverageTradeApi
import datetime
import time
import json
import pandas as pd
#kara~madeの期間の損益を出力。
kara = datetime.datetime(2018, 3, 16, 0, 0, 0)
made = datetime.datetime(2018, 3, 16, 23, 59, 59)
unix = time.mktime(kara.timetuple())
unixz = time.mktime(made.timetuple())
zaif = ZaifLeverageTradeApi("YOUR_API_KEY","YOUR_API_SECRET")
gp = zaif.get_positions(type="futures",group_id=1,since=int(unix),end=int(unixz))
#print(gp)
frame = pd.DataFrame(gp)
frame.to_csv(str(unix)+".csv",index=True,encoding="utf-8",mode="a",header=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment