Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1036166 // TickerPoint - a point in a ticker sequence

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (10036L) is out of date.

1  
// a point in a ticker sequence
2  
srecord noeq TickerPoint(TickerSequence ticker, long currentTime) {
3  
  double currentPrice() { ret lookback(0); }
4  
  
5  
  // time = ms to look back
6  
  double lookback(long time) {
7  
    ret ticker.priceAtTimestamp(currentTime-time);
8  
  }
9  
  
10  
  // false if looking back would require going outside of the time range
11  
  bool canLookback(long time) {
12  
    ret currentTime-time >= ticker.startTime();
13  
  }
14  
  
15  
  TickerSequence ticker() { ret ticker; }
16  
  long currentTime aka time() { ret currentTime; }
17  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036166
Snippet name: TickerPoint - a point in a ticker sequence
Eternal ID of this version: #1036166/6
Text MD5: eaa66fef5291c9f95727ae8f67b29f90
Author: stefan
Category: javax / trading bot
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-07 18:35:33
Source code size: 535 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 166 / 229
Version history: 5 change(s)
Referenced in: [show references]