0bps

Strategy vault / Other

Get OK Futures Real Time Price Limit

Get OKEx futures real-time limit price, only valid for live trading. Code is for learning purposes only. The author does not guarantee the correctness of the program. Any consequences of trading based on this are…

JavaScriptOther
Author
数·狂
Complexity
Starter · 22 lines
Parameters
0

Get OKEx futures real-time limit price, only valid for live trading. Code is for learning purposes only. The author does not guarantee the correctness of the program. Any consequences of trading based on this are your own responsibility.

Source JavaScript

$.GetLimit = function(currStr, contract) {
    var url = "https://www.okcoin.com/api/v1/future_price_limit.do?symbol=" + currStr + "_usd&contract_type=" + contract;
    var httpResp = HttpQuery(url);
    if (httpResp.indexOf("false") != -1) return null;
    var parsedResp;
    try {
        parsedResp = JSON.parse(httpResp);
    } catch (e) {
        return null;
    }
    return parsedResp;
};

function main() {
    var limit = $.GetLimit('btc', 'quarter'); // Get Bitcoin quarterly contract limit price
    Log(limit.high, limit.low); // Highest buy, lowest sell limit price
    limit = $.GetLimit('ltc', 'this_week'); // Get Litecoin weekly contract limit price
    Log(limit.high, limit.low); // Highest buy, lowest sell limit price
    limit = $.GetLimit('btc', 'next_week'); // Get Bitcoin next week contract limit price
    Log(limit.high, limit.low); // Highest buy, lowest sell limit price
    
}

Published by 数·狂 on the FMZ strategy square · last modified 2016-06-19. 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/Get-OK-Futures-Real-Time-Price-Limit.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