Coder Social home page Coder Social logo

Comments (4)

sshcli avatar sshcli commented on June 12, 2024 3

@peters-r try whith the TimeFrameUnit:

from alpaca.data.timeframe import TimeFrame              
from alpaca.data.timeframe import TimeFrameUnit   
StockBarsRequest(symbol_or_symbols=[SYMBOL],timeframe=TimeFrame(1, TimeFrameUnit.Day), start=START, end=END)

from alpaca-py.

alessiocastrica avatar alessiocastrica commented on June 12, 2024 1

This is expected TimeFrame is not an Enum, but TimeFrameUnit is.

from alpaca-py.

alessiocastrica avatar alessiocastrica commented on June 12, 2024 1

@peters-r I agree with you that having the same name can be confusing, but changing the API would be a breaking change that I would prefer to avoid right now.
The TimeFrame Day class property was actually imagined as a shortcut, please check out the implementation here.
So in your case you can just use timeframe=TimeFrame.Day
Hope this helps.

from alpaca-py.

peters-r avatar peters-r commented on June 12, 2024

So it's not a bug, but still I think the API is highly confusing in that regard. Maybe could be worth to at least make sure that TimeFrameUnit and TimeFrame don't have the same 'Day' property or to make it more explicit that one is an enum and the other isn't. Or to update the docs to make it more obvious. I probably wouldn't have filed a bug if I found it in the docs.

It works for me now. Thanks for your quick support!

from alpaca-py.

Related Issues (20)

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.