Here is the code of Python:
import trendln
import yfinance as yf # requires yfinance - pip install yfinance
tick = yf.Ticker('^GSPC') # S&P500
hist = tick.history(period="max", rounding=True)
h = hist[-1000:].Close
mins, maxs = trendln.calc_support_resistance(h)
Here,
type(tick)
<class 'yfinance.ticker.Ticker'>
type(hist)
<class 'pandas.core.frame.DataFrame'>
type(h)
<class 'pandas.core.series.Series'>
type(mins) and type(maxs)
<class 'tuple'>
I have tried this:
using (Py.GIL())
{
dynamic tick = yf.Ticker("^GSPC");
dynamic hist = tick.history("max",true);
}
But I do not understand how I can handle the data the same way in Python.
To be Specific, How I can handle the dataframe and Tuples which in the style like this h = hist[-1000:].Close
and mins/maxs
in C#.
Please suggest me the easiest way to do that.