mathpaquette / IQFeed.CSharpApiClient

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

translate c# example to Python #86

Open mathpaquette opened 4 years ago

mathpaquette commented 4 years ago

Python is very popular these days and having the examples translated in would be useful for many.

The task is to translate these examples: https://github.com/mathpaquette/IQFeed.CSharpApiClient/tree/master/src/IQFeed.CSharpApiClient.Examples

We can merge them one by one so if you are welling to help, pick one and raise a PR. Thanks

avalanche-zak commented 2 years ago

In re: to more python examples... I use IQFeed with Ninjatrader, and recently started manipulating data with python/pandas, and this package is great! I have figured out how to pull the daily, weekly, and monthly timeframes so far.

But am struggling with figuring out the code for intraday intervals (for example, 5min or 240min, etc).

Here is how I am pulling D/W/M timeframes:

daily = lookupClient.Historical.GetHistoryDailyDatapoints(ticker, 200) weekly = lookupClient.Historical.GetHistoryWeeklyDatapoints(ticker, 200) monthly = lookupClient.Historical.GetHistoryMonthlyDatapoints(ticker, 200)

for dailyMessages in daily: print(dailyMessages) for weeklyMessages in weekly: print(weeklyMessages) for monthlyMessages in monthly: print(monthlyMessages)

But I can't seem to figure out how to code the intervals to provide a successful data pull for intradays. An intraday example for a simple historical get history would be great (for example 5min timeframe).

Thanks for any assistance.

R470R commented 1 year ago

Yes intraday would be awesome

R470R commented 1 year ago

try as https://github.com/mathpaquette/IQFeed.CSharpApiClient/blob/master/src/IQFeed.CSharpApiClient.Examples/Examples/BasicFileHistorical/BasicFileHistoricalExample.cs

with lookupClient.Historical.GetHistoryIntervalDays("EURCAD.FXCM",3600,10,100)

worked for me

R470R commented 1 year ago

timeframe must be in seconds ex 3600 is 1 hour