Git Product home page Git Product logo

Comments (3)

fhqvst avatar fhqvst commented on July 23, 2024

Hm, I'm not 100% sure I understand what you mean. Are you saying that you want to place a buy order, and then, if at a later point a sell order at your price is placed, you want the order to be executed? I'm afraid this is currently not possible since the backtesting broker executes your order instantly.

DevAlpha has no notion of an order book, but you could model this yourself very easily. Maybe something like this could suffice?

// Holds pending orders
const orders = []

// Create DevAlpha trader
const trader = createTrader({ ... }, (context, action) => {

  if (action.type === 'myOrderbookFeed') {
    orders.forEach((order, index) => {
      if (order.quantity > 0 && action.payload.bestAsk <= order.price) {

        // Place DevAlpha order
        context.order({ ... })
        
        // Update pending orders
        orders = orders.filter((o, j) => j !== index)

      } else if (...) {
        // Do the same but for sell-side
      }
    })
  }

  if (action.type === 'myMagicSignal') {
    // Add to pending orders
    orders.push({ ... })
  }

});

// Run the thing
trader.resume()

Do you have an example of what you want to accomplish?

from devalpha-node.

pabx06 avatar pabx06 commented on July 23, 2024

The notions of:
-order book.
-limit order
-Cancel not filed limit order.
Are missing that is too bad. It is very hard to find a back testing platform. Also the back-testing broker makes assumption that you always get a fill. While in real life it is a pain because of orders queuing ...

from devalpha-node.

fhqvst avatar fhqvst commented on July 23, 2024

One nice thing about DevAlpha is that you're able to provide as many data sources as you like, and DevAlpha will emit each data point as if they were sorted by timestamp.

On the other hand, this flexibility means that DevAlpha does not know what type of data you feed it, so it does not know whether you feed tick data for a cryptocurrency or a time series of car sales for Toyota.

Regarding limit orders: They're currently the only supported order type, but as you say, during backtesting orders will always get filled instantly. I've added the order book feature to the icebox, and if there's enough need for it I'll make sure to implement it.

from devalpha-node.

Related Issues (16)

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.