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

35
LINES

< > BotCompany Repo | #1036557 // G22PassiveTradingStrategy

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

Libraryless. Click here for Pure Java version (30329L/191K).

concept G22PassiveTradingStrategy extends G22TradingStrategy {
  // A regular expression that will be used to match
  // the "strategy" field coming from TradingView to
  // distinguish this strategy from others on the same coin.
  settableWithVar S tradingViewRegexp;
  
  void price(double price) {
    if (currentPrice == price) ret;
    currentPrice = price;
    afterStep(); change();
  }
  
  bool tradingViewMatch(S text) {
    ret empty(cleanedTradingViewRegexp())
      || safeRegexpFindIC(cleanedTradingViewRegexp(), text);
  }
  
  S cleanedTradingViewRegexp() {
    ret trim(tradingViewRegexp);
  }
  
  LS addPassiveTradingStatus(LS list) {
    if (nempty(tradingViewRegexp))
      list.add("TradingView regexp: " + cleanedTradingViewRegexp());
    ret list;
  }
  
  LS status() {
    ret addPassiveTradingStatus(super.status());
  }
  
  LS activationStatus() {
    ret addPassiveTradingStatus(super.activationStatus());
  }
}

Author comment

Began life as a copy of #1036351

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1036557
Snippet name: G22PassiveTradingStrategy
Eternal ID of this version: #1036557/13
Text MD5: 07fb1154796fa17c2a8183c70d7ee990
Transpilation MD5: 784c3dae098a0147d0726a2e3b9307ca
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-04-27 22:48:09
Source code size: 975 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 41 / 99
Version history: 12 change(s)
Referenced in: [show references]