• Ask a question
  • Spaces
    • TT® Platform
    • Autospreader®
    • Autotrader™
    • Charting & Analytics
    • Options
    • ADL®
      • ADL Samples
    • RTD
    • APIs
      • TT .NET SDK
      • TT API & XT API
      • TT REST API
    • Cryptocurrencies
    • Topics
    • Questions
    • Articles
    • Ideas
    • Badges
  • Sign in
  • Home /
  • ADL® /
avatar image
0
Question by sphaasz · Oct 02, 2020 at 05:06 PM · Orders

Limit Order Book - How to extract t, t-1, t-n data for ask price, bid price, and related volume?,Order Book - How to extract t, t-1, t-n data for bid, ask, volume?

Good day. I am trying to store the prices and volumes for 10 levels of each the ask and bid side of the order book. This would provide 40 values at each time step. Say time step is 1 hour. Then I would like to (i) calculate various features such as %_return_ask from one time step to the next (t, t-1) and then (ii) average the %_return_ask over say the last 4 hours. Hence, I need to be able to pull such info from some sort of array. Any thoughts?,Good day. I am trying to store the prices and volumes for 10 levels of each the ask and bid side of the order book. This would provide 40 values at each time step. Say time step is 1 hour. Then I would like to (i) calculate various features such as %_return_ask from one time step to the next (t, t-1) and then (ii) average the %_return_ask over say the last 4 hours. Hence, I need to be able to pull such info from some sort of array. Any thoughts?

Comment
Add comment
10 |1800 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by russelltromans-1 · Oct 15, 2020 at 05:03 PM

The only way to store an array is to use a value bucket, more info on the value bucket can be found here: https://library.tradingtechnologies.com/adl/db-val...

It will depend on how exactly you wish to use the data which will dictate which configuration your logic will take. Below is a simplified example of how to collect data over multiple time periods and then access the data for use in your calculations.

We start the algo using a Generator block set to produce a discrete message at a set time. This will then be used to take the initial data capture and arm the repeating generator which will create a discrete message each hour.
The discrete message then passes into the Value Accumulator labelled 'Interval count', this is seeded with a value of '1' so that it counts the number of discrete messages that have passed through it. Each Value Bucket will reference this accumulator as it's storeKey and use a mode of 'Last'. As the value bucket is only able to have a single storeVal we use a separate Value Bucket for each piece of data we wish to collect.
Once the data collection is complete the discrete message will then pass into the Branch Block labelled 'Sufficient Data' which will check if the interval count is greater than or equal to the number of intervals required to perform our calculation. If our condition is met the discrete message will pass to the loop block where we will use the index output value to amend the lookup value of the Value Buckets allowing access to the array of data stored within them for the last x values.

For more information on working with data in this manner you may wish to refer to the following post: https://community.tradingtechnologies.com/question...


data-collection.png (206.4 kB)
Comment
Add comment · Share
10 |1800 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by sphaasz · Oct 19, 2020 at 12:25 AM

Good day. Thanks so much for the response. Really helped. Very detailed and informative. Much appreciated. S.

Comment
Add comment · Share
10 |1800 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Community

Ask questions and share ideas about the TT® and X_TRADER® platforms.

First time here? See our Getting Started Guide and FAQs.

Follow

Follow this Question

Answers Answers and Comments

29 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Quantity 0 in order block 1 Answer

Need some help with algos (loop & formulas) 1 Answer

Attaching an OMA to an OTA child order 2 Answers

Order Block fire more than once 3 Answers

Necessity of cover orders 1 Answer

Trading Technologies Home - Legal - Privacy - Contact

© 2017 Trading Technologies International, Inc. All rights reserved.

Powered by AnswerHub

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • TT® Platform
  • Autospreader®
  • Autotrader™
  • Charting & Analytics
  • Options
  • ADL®
    • ADL Samples
  • RTD
  • APIs
    • TT .NET SDK
    • TT API & XT API
    • TT REST API
  • Cryptocurrencies
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges