0
에 내 브로커의 API (xTrade 브로커)에서브로커 API, JSON은 DataFrame
내가 먼저 시도 기록 데이터를 얻기 위해 노력했다 BackTesting을 위해 사용할 수 있도록 적절한 DataFrame 형식으로 가져 오기 위해 mangaged가 아닙니다.
def main():
# create new api client and connect to the SERVER
apiClient = APIClient(address=SERVER, port=PORT, encrypt=True)
# prepare the login command
loginCmd = loginCommand(USERID, PASSWORD)
# execute login command and get streaming session ID
loginResponse = apiClient.execute(loginCmd)
streamSessionId = loginResponse['streamSessionId']
print('Logged in as ' + str(USERID))
# create new stream client with given stream session ID
streamClient = APIStreamClient(address=SERVER, port=STREAMING_PORT, ssId=streamSessionId)
print('Streaming opened')
# prepare get server time command
getServerTimeCmd = baseCommand('getServerTime', dict())
# get server time
getServerTimeResponse = apiClient.execute(getServerTimeCmd)
print('Server time: ' + str(getServerTimeResponse['returnData']['timeString']))
# prepare get all symbols command`
mySymbol = 'EURUSD'
getHistory = baseCommand("getChartLastRequest", dict(info = dict(symbol = mySymbol, period = 5, start = 1384981096762)))
history = apiClient.execute(getHistory)
x = pd.DataFrame(history['returnData']['rateInfos'])
해당 JSON의 데이터를 DataFrame으로 추출 할 수 없습니다.
위의 스크립트 다음에 x를 인쇄 할 경우. 또한 단순히 x를 인쇄하면 이름 'x'가 정의되지 않았다고 알립니다.
''main()''은''x''를 반환해야합니까? ''x''가 정의되어 있지 않으면 판다 문제처럼 들리지 않습니다. –
x가 정의되지 않았습니다. x 변수에 DataFrame을 지정하고 싶습니다. –