0bps

Strategy vault / Other

Earnings Statistics Copy

Statistics of total profits from OK and Bitvc futures; OK is the main exchange;

JavaScriptOther
Author
总值约: 23938.37 元
Complexity
Starter · 54 lines
Parameters
1

Statistics of total profits from OK and Bitvc futures; OK is the main exchange;

Parameters

NameDefaultWhat it controls
LXT20Cycle period (seconds).)

Source JavaScript

var okrights=0;
var vcright=0;
var InitRights=0;
var totalrights=0;
var profit=0;
var oldprofit=0;

SetErrorFilter("502:|503:|unexpected|network|timeout|WSARecv|Connect|GetAddr|no such|reset|http|received|EOF");



function Rights() {
        
        var accountok;
        var accountvc;
        while (!(accountok = exchanges[0].GetAccount())) {
            Sleep(500);
        }
        while (!(accountvc = exchanges[1].GetAccount())) {
            Sleep(500);
        }
        var objok;
        var objvc;
        
        objok=JSON.parse(exchanges[0].GetRawJSON());
        objvc=JSON.parse(exchanges[1].GetRawJSON());
        
        okrights=objok.info["btc"].rights;
        vcrights=objvc.dynamicRights;
        totalrights=okrights+vcrights;
        
        
}

function main(){
    Rights();
    InitRights=totalrights;
   Log("Initial equity total_BTC",InitRights);
   while(true){
    Rights();
    profit=totalrights-InitRights;
    if(profit!==oldprofit){
    LogProfit(profit,"BTC");
    oldprofit=profit;
    }
    Sleep(LXT*1000);
   }
   
 
}



Published by 总值约: 23938.37 元 on the FMZ strategy square · last modified 2015-02-28. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Earnings-Statistics-Copy.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open