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

60
LINES

< > BotCompany Repo | #1036258 // G22TradingStrategy backup

JavaX fragment (include)

abstract concept G22TradingStrategy extends ConceptWithChangeListeners {
  settable bool verbose;
  
  gettable S globalID = aGlobalID();

  gettable transient Q q = startQ();
  
  // link to market (optional)
  transient settable IFuturesMarket market;
  
  settableWithVar S cryptoCoin;
  settableWithVar S marginCoin = "USDT";
  
  settableWithVar bool usingLiveData;
  settableWithVar bool doingRealTrades;
  settableWithVar bool demoCoin;
  settableWithVar bool active;
  
  // moved to archive (out of main list)
  settableWithVar bool archived;
  
  settableWithVar double adversity = 0.2;
  
  settableWithVar new LS log;
  
  // increment of crypto we can bet on
  settableWithVar double cryptoStep = 0.0001;
  
  // minimum crypto we need to bet on
  settableWithVar double minCrypto = 0.0001;
  
  settableWithVar double maxInvestment;
  
  swappable long currentTime() { ret now(); }
  
  // Note from price feeder
  settableWithVar S feedNote;
  
  void log(O o) {
    if (o != null) {
      log.add(print(str(o)));
      change();
    }
  }
  
  LS activationStatus() {
    ret llNempties(
      active ? "Active" : "Inactive",
      empty(cryptoCoin) ? null
        : "coin: " + cryptoCoin + " over " + marginCoin
          + stringIf(demoCoin, " (demo coin)"),
      stringIf(market != null, "connected to market"),
      stringIf(usingLiveData, "using live data"),
      stringIf(doingRealTrades, "real trades")
    );
  }
  
  abstract Cl openPositions();
  abstract Cl closedPositions();
}

Author comment

Began life as a copy of #1036209

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036258
Snippet name: G22TradingStrategy backup
Eternal ID of this version: #1036258/1
Text MD5: c852445735e6a42fb16abc7989348f2a
Author: stefan
Category: javax / trading
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-05 20:13:56
Source code size: 1567 bytes / 60 lines
Pitched / IR pitched: No / No
Views / Downloads: 50 / 55
Referenced in: [show references]