blankly-finance / blankly

🚀 💸 Easily build, backtest and deploy your algo in just a few lines of code. Trade stocks, cryptos, and forex across exchanges w/ one package.
https://package.blankly.finance
GNU Lesser General Public License v3.0
2.13k stars 268 forks source link

state.interface.history duplicating prices #232

Open chaterpaul opened 1 year ago

chaterpaul commented 1 year ago

Description

Hi, I was using your Screener example, and when printing out the dataframe for state.interface.history the prices are duplicated.

def is_stock_buy(symbol, state: ScreenerState):

This runs per stock

    prices = state.interface.history(symbol, 40) # get past 40 data points
    print(prices)

returns

      time     open      high       low   close      volume

18 1677042000 148.870 149.9500 147.1600 148.91 51037691.0 19 1677042000 148.870 149.9500 147.1600 148.91 51037691.0 20 1677128400 150.090 150.3400 147.2400 149.40 48412870.0 21 1677128400 150.090 150.3400 147.2400 149.40 48412870.0 22 1677214800 147.110 147.1900 145.7202 146.71 55469643.0 23 1677214800 147.110 147.1900 145.7202 146.71 55469643.0 24 1677474000 147.710 149.1700 147.4500 147.92 45007197.0 25 1677474000 147.710 149.1700 147.4500 147.92 45007197.0 26 1677560400 147.050 149.0800 146.8300 147.41 50575615.0 ...

Platform Info

Also if you look at your help from the screener : https://docs.blankly.finance/examples/rsi-screener/

if you cut and paste the code into python it will not run there are several errors in it.

Thanks

Paul

BTW. Love this its cool.

EmersonDove commented 1 year ago

Hey Paul, sorry about the errors, I think we changed the screener API and didn't update the the docs, I'll add that to the project TODO.

Can you give some more info on what stock you're querying? I'll take a look on my local because that looks like unexpected behavior.

chaterpaul commented 1 year ago

Hi,

I was testing AAPL using Alpaca.

Regards

Paul

From: Emerson Dove @.> Sent: 21 March 2023 21:21 To: blankly-finance/blankly @.> Cc: Paul Chater @.>; Author @.> Subject: Re: [blankly-finance/blankly] state.interface.history duplicating prices (Issue #232)

WARNING: This email originated from outside of the organization. DO NOT click links, open attachments, or respond unless you recognize the sender and know the content is safe.


Hey Paul, sorry about the errors, I think we changed the screener API and didn't update the the docs, I'll add that to the project TODO.

Can you give some more info on what stock you're querying, I'll take a look on my local because that looks like unexpected behavior.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/blankly-finance/blankly/issues/232*issuecomment-1478595610__;Iw!!F1Q1IbZmrAg!E8sEE4NV6zOl7Tk0j7hq_ygSsUTVn6A_WA87znz1p3dSNGqZl3z7TwyHpp2c1LIE7xNWGjDSvbtOy92heLpSdbJZiwM$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AKDMBPJ6LYKG733INF5ZZPLW5ILVFANCNFSM6AAAAAAWC7OZ6I__;!!F1Q1IbZmrAg!E8sEE4NV6zOl7Tk0j7hq_ygSsUTVn6A_WA87znz1p3dSNGqZl3z7TwyHpp2c1LIE7xNWGjDSvbtOy92heLpSzkvopUk$. You are receiving this because you authored the thread.Message ID: @.**@.>>


This email, including any attachments, may contain confidential and/or proprietary information intended only for the use of the recipient. If you are not the intended recipient, any distribution, copying, or use of this email or its attachments is prohibited. If you received this email in error, please reply to the sender immediately and delete this message and any copies.

Bentley Systems has taken all reasonable steps to ensure that this communication is free from viruses, data corruption, and unauthorized alteration. Bentley Systems does not accept liability for any damages that may be incurred as a result of this or any communication by email

[https://cdn2.webdamdb.com/310th_sm_UnR3pO7k0ir0.jpg?1616176329]

EmersonDove commented 1 year ago

Hey @chaterpaul I recommend installing yfinance using pip install yfinance and then changing use_yfinance to true inside your settings.json. This will use yfinance for history calls instead of Alpaca which appears to be correct until I can get around to fixing this.