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).

1  
// Each instance is for one coin
2  
sclass G22DriftSystem extends MetaWithChangeListeners {
3  
  settable S cryptoCoin;
4  
  
5  
  // Position currently taken on platform (in crypto coin units)
6  
  // Positive for long position, negative for short position,
7  
  // zero for no position.
8  
  settable double driftOnPlatform;
9  
  
10  
  // Drift value we want to have
11  
  settable double targetDrift;
12  
  
13  
  transient settable IFuturesMarket market;
14  
  
15  
  settableWithVar FutureCoinParameters coinParams;
16  
  
17  
  Set<G22TradingStrategy> activeStrategies = syncLinkedHashSet();
18  
  
19  
  double calculateTargetDrift() {
20  
    double drift = 0;
21  
    for (strat : cloneList(activeStrategies))
22  
      drift += strat.drift();
23  
    targetDrift(drift);
24  
    ret drift;
25  
  }
26  
}

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: 71 / 112
Version history: 4 change(s)
Referenced in: [show references]