Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. sashwath91
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    S
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 1
    • Groups 0

    sashwath91

    @sashwath91

    1
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    sashwath91 Unfollow Follow

    Best posts made by sashwath91

    • Incorrect time for intraday

      I continue to see the time as 23:59:59 despite using bt.TimeFrame.Minutes.

      Below is the code:

       data = bt.feeds.YahooFinanceCSVData(
              dataname='TATAMOTORS-EQ-15.csv',
              dtformat=("%Y/%m/%d %H.%M.%S"),
              timeframe=bt.TimeFrame.Minutes, 
              compression=1,
              datetime=0,
              # Do not pass values before this date
              fromdate=datetime.datetime(2021, 12, 1, 9, 15, 0),
              # Do not pass values before this date
              todate=datetime.datetime(2022, 2, 28, 15, 15, 0),
              # Do not pass values after this date
              
              time=1,
              open=2,
              high=3,
              low=4,
              close=5,
              openinterest=-1)
      

      Below is the output:

      2022-02-25 23:59:59, Close, 463.40, SL, 456.55, ATR, 3.42, cash, 139930.62, time, 463.40
      2022-02-25 23:59:59, Close, 461.90, SL, 456.55, ATR, 3.29, cash, 139521.81, time, 461.90
      2022-02-25 23:59:59, Close, 461.00, SL, 456.55, ATR, 3.14, cash, 139276.53, time, 461.00
      2022-02-25 23:59:59, Close, 460.00, SL, 456.55, ATR, 2.97, cash, 139003.99, time, 460.00
      2022-02-25 23:59:59, Close, 459.40, SL, 456.55, ATR, 2.98, cash, 138840.46, time, 459.40
      2022-02-25 23:59:59, Close, 460.05, SL, 456.55, ATR, 2.83, cash, 139017.62, time, 460.05
      2022-02-25 23:59:59, Close, 458.10, SL, 456.55, ATR, 2.96, cash, 138486.16, time, 458.10
      2022-02-25 23:59:59, Close, 458.50, SL, 456.55, ATR, 2.76, cash, 138595.18, time, 458.50
      2022-02-25 23:59:59, Close, 460.20, SL, 456.55, ATR, 2.87, cash, 139058.50, time, 460.20
      2022-02-25 23:59:59, Close, 460.85, SL, 456.55, ATR, 2.68, cash, 139235.65, time, 460.85
      

      Below is the input:

      Date	Open	High	Low	Close	Adj. Close
      01-12-2021 09:15	467.85	469.95	463.55	467.55	467.55
      01-12-2021 09:30	467.45	470	464.7	465	465
      01-12-2021 09:45	465	469.4	464.05	468.25	468.25
      01-12-2021 10:00	468	468.85	466.3	466.45	466.45
      01-12-2021 10:15	466.45	468.25	465.15	467	467
      01-12-2021 10:30	466.75	471	466.75	470.9	470.9
      01-12-2021 10:45	471.2	471.7	469	469.5	469.5
      01-12-2021 11:00	469.5	471.25	469.5	469.9	469.9
      01-12-2021 11:15	470	470.65	468.75	470.3	470.3
      01-12-2021 11:30	470.1	472.3	469.6	471.05	471.05
      01-12-2021 11:45	471.1	471.6	470.05	471.55	471.55
      01-12-2021 12:00	471.45	472.5	470	470.2	470.2
      
      posted in General Code/Help
      S
      sashwath91

    Latest posts made by sashwath91

    • Incorrect time for intraday

      I continue to see the time as 23:59:59 despite using bt.TimeFrame.Minutes.

      Below is the code:

       data = bt.feeds.YahooFinanceCSVData(
              dataname='TATAMOTORS-EQ-15.csv',
              dtformat=("%Y/%m/%d %H.%M.%S"),
              timeframe=bt.TimeFrame.Minutes, 
              compression=1,
              datetime=0,
              # Do not pass values before this date
              fromdate=datetime.datetime(2021, 12, 1, 9, 15, 0),
              # Do not pass values before this date
              todate=datetime.datetime(2022, 2, 28, 15, 15, 0),
              # Do not pass values after this date
              
              time=1,
              open=2,
              high=3,
              low=4,
              close=5,
              openinterest=-1)
      

      Below is the output:

      2022-02-25 23:59:59, Close, 463.40, SL, 456.55, ATR, 3.42, cash, 139930.62, time, 463.40
      2022-02-25 23:59:59, Close, 461.90, SL, 456.55, ATR, 3.29, cash, 139521.81, time, 461.90
      2022-02-25 23:59:59, Close, 461.00, SL, 456.55, ATR, 3.14, cash, 139276.53, time, 461.00
      2022-02-25 23:59:59, Close, 460.00, SL, 456.55, ATR, 2.97, cash, 139003.99, time, 460.00
      2022-02-25 23:59:59, Close, 459.40, SL, 456.55, ATR, 2.98, cash, 138840.46, time, 459.40
      2022-02-25 23:59:59, Close, 460.05, SL, 456.55, ATR, 2.83, cash, 139017.62, time, 460.05
      2022-02-25 23:59:59, Close, 458.10, SL, 456.55, ATR, 2.96, cash, 138486.16, time, 458.10
      2022-02-25 23:59:59, Close, 458.50, SL, 456.55, ATR, 2.76, cash, 138595.18, time, 458.50
      2022-02-25 23:59:59, Close, 460.20, SL, 456.55, ATR, 2.87, cash, 139058.50, time, 460.20
      2022-02-25 23:59:59, Close, 460.85, SL, 456.55, ATR, 2.68, cash, 139235.65, time, 460.85
      

      Below is the input:

      Date	Open	High	Low	Close	Adj. Close
      01-12-2021 09:15	467.85	469.95	463.55	467.55	467.55
      01-12-2021 09:30	467.45	470	464.7	465	465
      01-12-2021 09:45	465	469.4	464.05	468.25	468.25
      01-12-2021 10:00	468	468.85	466.3	466.45	466.45
      01-12-2021 10:15	466.45	468.25	465.15	467	467
      01-12-2021 10:30	466.75	471	466.75	470.9	470.9
      01-12-2021 10:45	471.2	471.7	469	469.5	469.5
      01-12-2021 11:00	469.5	471.25	469.5	469.9	469.9
      01-12-2021 11:15	470	470.65	468.75	470.3	470.3
      01-12-2021 11:30	470.1	472.3	469.6	471.05	471.05
      01-12-2021 11:45	471.1	471.6	470.05	471.55	471.55
      01-12-2021 12:00	471.45	472.5	470	470.2	470.2
      
      posted in General Code/Help
      S
      sashwath91