0

I'm using the Stock Indicators module in Python. I've looked at the documentation to determine how to make a Quote, and then use that in the different functions to determine an indicator. It looks a bit like this:

import pandas as pd
from stock_indicators import CandlePart, indicators, Quote
from datetime import datetime

df = pd.read_csv("my/file/path/file.csv")

for i in range(len(df.iloc[:,0])):
    df.iloc[i,0] = datetime.strptime(df.iloc[i,0], "%Y-%m-%d")

quotes_list = [
    Quote(d,o,h,l,c,v) 
    for d,o,h,l,c,v 
    in zip(df['Date'], df['Open'], df['High'], df['Low'], df['Close'], df['Volume'])
]

results = indicators.get_sma(quotes_list, 20, CandlePart.VOLUME)

But then, when I use the method .find on results, or

print(results.find(df.iloc[21,0]))

it returns with

<stock_indicators.indicators.sma.SMAResult object at 0x000001837FEB3820>

Now, I've spent quite a bit of time looking at the code, and understand that there is some C# code that is used, and there are conversions between Python objects and C# objects, but that isn't anything I should need to worry about, not that I'm aware of.

In addition, I read that when using the zip function, it will return the memory address at times, rather than the actual value. So, I constructed the quote_list differently than what is above, where I iterated over the dataframe differently with a for loop, creating a quote one at a time without using the zip function, but it still had the same results.

So how can I access the results values, rather than the object type and memory address? Is it due to the way that my quotes_list is constructed, or does it have to do with how I am trying to access the info from results?

U13-Forward
  • 69,221
  • 14
  • 89
  • 114

0 Answers0