Giter Site home page Giter Site logo

Comments (4)

jbaron avatar jbaron commented on September 4, 2024

Not sure it is wise to automatically make bracket orders not using extendedHours if the config says you want extendedHours.
This might confuse less experienced traders and people expect orders to be placed when they are not.

However, perhaps the default in config should be false for extendedHours. The main reason it is set to true is that I'm in Europe and a lot of testing is done on outside regular trading hours :)

As a short term solution, you can always use the following when creating your broker instance:

 val broker = AlpacaBroker {
        extendedHours = false
  }

from roboquant.

ktaneja avatar ktaneja commented on September 4, 2024

extendedHours is a part of AlpacaConfig but is hard coded. So the ask is to make it configurable.

Alpaca live trading does not allow extended hours trading for bracket orders (while paper trading has no issue). So it may be better to add a check before creating a bracket order.

From Alpaca Docs

Extended hours are not supported. extended_hours must be β€œfalse” or omitted.

from roboquant.

jbaron avatar jbaron commented on September 4, 2024

I'll some logic so you can also configure it via a property file. Then it is the same as the public/private keys. I also put the default to false, that is the safer option.

But just to be sure: you can already configure it in your code using the following pattern:

val broker = AlpacaBroker {
        extendedHours = false
  }

From then on the BracketOrder uses automaticallyfalse. So nothing is stoping you from using bracket orders right now (unless I still misunderstand something?).

from roboquant.

jbaron avatar jbaron commented on September 4, 2024

As usual, the latest snapshot now has the following included:

  1. Default for extended hours is set to false
  2. Next to in your own code, you can also configure this attribute via property files.
data class AlpacaConfig(
    var publicKey: String = Config.getProperty("alpaca.public.key", ""),
    var secretKey: String = Config.getProperty("alpaca.secret.key", ""),
    var accountType: AccountType = AccountType.PAPER,
    var dataType: DataType = DataType.IEX,
    var extendedHours: Boolean = Config.getProperty("alpaca.extendedhours", false),
)

from roboquant.

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.