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

40
LINES

< > BotCompany Repo | #1036353 // AbstractJuicer

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

Libraryless. Click here for Pure Java version (15020L/88K).

persistable abstract sclass AbstractJuicer extends MetaWithChangeListeners {
  // what we are monitoring & closing (a position or a strategy)
  settableWithVar Juiceable juiceable;
  
  settableWithVar double juiceValue;
  
  settableWithVar bool closingAllowed = true;
  
  // last calculated signals
  settableWithVar L<SignalWithStrength> currentSignals;
  
  settableWithVar L<SignalWithStrength> suppressedSignals;
  
  event calculatingCloseSignals(L<SignalWithStrength> outList);
  
  // must return a new list
  swappable L<SignalWithStrength> calculateCloseSignals() {
    grabJuiceValue();
    new L<SignalWithStrength> signals;
    calculatingCloseSignals(signals);
    if (closingAllowed) {
      suppressedSignals(emptyList());
      currentSignals(signals);
    } else {
      suppressedSignals(signals);
      currentSignals(emptyList());
    }
    ret currentSignals;
  }
  
  void grabJuiceValue {
    juiceValue(juiceable.juiceValue());
  }
  
  selfType configClone() {
    ret restructure(this);
  }
  
  void copyTransientValuesFrom(AbstractJuicer juicer) {}
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036353
Snippet name: AbstractJuicer
Eternal ID of this version: #1036353/20
Text MD5: b60bf0510387cd5c497ff5c786400263
Transpilation MD5: f5375a6011d4b404aefde62fa54bef70
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-18 04:35:36
Source code size: 1122 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 232 / 336
Version history: 19 change(s)
Referenced in: [show references]