mathpaquette / IQFeed.CSharpApiClient

IQFeed.CSharpApiClient is fastest and the most well-designed C# DTN IQFeed socket API connector available
MIT License
121 stars 43 forks source link

how to pass retrieved data to a readable format #151

Open R470R opened 1 year ago

R470R commented 1 year ago

Hello, trying to work with hourly data:

#retrieve iqfeed last 84 000 rows of pair by iqfeed_api

# Dynamically add IQFeed.CSharpApiClient DLL
assembly_path = r"C:\Users\xxxxx\Desktop\xxxx\iqfeed.csharpclient_dll"

import sys
sys.path.append(assembly_path)

# Reference IQFeed.CSharpApiClient DLL
import clr
clr.AddReference("IQFeed.CSharpApiClient")

from IQFeed.CSharpApiClient import IQFeedLauncher

# Step 1 - Run IQConnect launcher
IQFeedLauncher.Start("51xxxx", "xxxxxxxx", "xxxx9")

# Step 2 - Use the appropriate factory to create the client
from IQFeed.CSharpApiClient.Lookup import LookupClientFactory
lookupClient = LookupClientFactory.CreateNew()

# Step 3 - Connect it
lookupClient.Connect()
# Step 4 - Make any requests you need or want! 

bars = lookupClient.Historical.GetHistoryIntervalDays("EURCAD.FXCM",3600,0,1) 
#print(bars)
for bar in bars:
    print(bar)

get me bar data: Timestamp: 23/03/2023 12:00:00, High: 1,48943, Low: 1,48635, Open: 1,48726, Close: 1,48932, TotalVolume: 239549, PeriodVolume: 12855, NumberOfTrades: 0, RequestId:

that is type: System.Collections.Generic.IEnumerable[IntervalMessage]

My problem is, how to manipulate with python (put into dict or some pandas or numpy)...

thanks

R470R commented 1 year ago

found a way by turning ToString().split()

is not perfect but does the job

mathpaquette commented 1 year ago

toCsv() ?

mathpaquette commented 1 year ago

@R470R missing toCsv()