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.

// a point in a ticker sequence
srecord noeq TickerPoint(TickerSequence ticker, long currentTime) {
  double currentPrice() { ret lookback(0); }
  
  // time = ms to look back
  double lookback(long time) {
    ret ticker.priceAtTimestamp(currentTime-time);
  }
  
  // false if looking back would require going outside of the time range
  bool canLookback(long time) {
    ret currentTime-time >= ticker.startTime();
  }
  
  TickerSequence ticker() { ret ticker; }
  long currentTime aka time() { ret currentTime; }
}

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: 69 / 118
Version history: 5 change(s)
Referenced in: #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167)