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

26
LINES

< > BotCompany Repo | #1036396 // G22DriftSystem - saves fees by merging shorts & longs

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

Libraryless. Click here for Pure Java version (29117L/182K).

// Each instance is for one coin
sclass G22DriftSystem extends MetaWithChangeListeners {
  settable S cryptoCoin;
  
  // Position currently taken on platform (in crypto coin units)
  // Positive for long position, negative for short position,
  // zero for no position.
  settable double driftOnPlatform;
  
  // Drift value we want to have
  settable double targetDrift;
  
  transient settable IFuturesMarket market;
  
  settableWithVar FutureCoinParameters coinParams;
  
  Set<G22TradingStrategy> activeStrategies = syncLinkedHashSet();
  
  double calculateTargetDrift() {
    double drift = 0;
    for (strat : cloneList(activeStrategies))
      drift += strat.drift();
    targetDrift(drift);
    ret drift;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036396
Snippet name: G22DriftSystem - saves fees by merging shorts & longs
Eternal ID of this version: #1036396/5
Text MD5: 3e07b07da988e9b6579a5d03e9703c6e
Transpilation MD5: 873c71b472b4a657bd5ba0436efb0321
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-06 16:15:52
Source code size: 747 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 142 / 201
Version history: 4 change(s)
Referenced in: [show references]