Code Monkey home page Code Monkey logo

ticker_data's Issues

Date range not fully pulled by get_data_yahoo

THE BELOW CODE IS RUNNING

  • BUT WHEN YOU RUN THE TICKER TABLE SEPERATELY, THE LAST FEW DATES ARE ONLY GETTING PULLED AND NOT ALL 10 DAYS - SO THE RESULT EVENTUALLY IS FALSE.

THE DATE RANGE IS BETWEEN 9/13 - 9/24....but only the last 4 days data is getting pulled ??

`import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import datetime as dt
import statistics
import yfinance as yf

import pandas_datareader.data as web

stock_data = {
'Eicher': 'eichermot.ns',
'Nestle': 'nestleind.ns'}

yf.pdr_override()
start = dt.datetime(2021,9,13)
end = dt.datetime.now()
#end = datetime.datetime.now()

for name, ticker in stock_data.items():

ticker = web.get_data_yahoo(ticker, start, end)


for day in ticker:

    ticker['True_Range'] = (ticker['Adj Close'].shift(1) - ticker['Low'])
    
    ticker.dropna(inplace=True)
    
    weekly_dynamic_sigma = 1.5 * statistics.pstdev(ticker['True_Range'])
    mean_tr = statistics.mean(ticker['True_Range'])
    gap = mean_tr + weekly_dynamic_sigma      


    prev_close = ticker['Adj Close'][-1]
    current_price = ticker['Adj Close']
    Buy_Zone = ticker['Adj Close'][-1] - gap
    

print(f'\t~~~~~~~~~~\n\tBUY  zone:  {Buy_Zone.round(2)}\n\t~~~~~~~~~~\n')`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.