前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >现货合约/秒合约跟单交易所平台开发源代码详情(案例)

现货合约/秒合约跟单交易所平台开发源代码详情(案例)

原创
作者头像
开发v_hkkf5566
发布2023-03-03 15:52:16
5870
发布2023-03-03 15:52:16
举报
文章被收录于专栏:技术开发分享技术开发分享

秒合约交易规则比较简捷,简单来说,首先必须选择要交易的数字货币。交易时间区间短为1min、3min、5min,长为60min;然后风险控制,在我们可以控制的风险范围内设定交易金额,设定盈余止损,最重要的是进行货币方向走势的技术分析。也就是说,在我们设置的交易区间内的涨跌方向,根据分析下单。

当指定了trade_id时, 返回一个成交Trade对象引用,不填trade_id参数调用本函数, 将返回包含用户当前交易日所有成交记录的一个Entity对象引用, 使用方法与dict一致, 其中每个元素的key为成交号, value为Trade,Trade继承于Entity。推荐优先使用 Order对象的属性trade_records获取某个委托单的相应成交记录, 更简单易用,仅当确有需要时才使用本函数。

is_changing(obj: Any, key: Optional[Union[str, List[str]]] = None):判定obj最近是否有更新。当业务数据更新导致 wait_update 返回后可以使用该函数判断本次业务数据更新是否包含特定obj或其中某个字段 。如果本次业务数据更新包含了待判定的数据则返回 True, 否则返回 False。关于判断K线更新的说明: 当生成新K线时,其所有字段都算作有更新,若此时执行 api.is_changing(klines.iloc[-1]) 则一定返回True。

代码语言:javascript
复制
 /**
    * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
    * @param _spender The address which will spend the funds.
    * @param _value The amount of tokens to be spent.
    */
    function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {        // To change the approve amount you first have to reduce the addresses`
        //  allowance to zero by calling `approve(_spender, 0)` if it is not
        //  already 0 to mitigate the race condition described here:
        //  
        require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
    }    /**
    * @dev Function to check the amount of tokens than an owner allowed to a spender.
    * @param _owner address The address which owns the funds.
    * @param _spender address The address which will spend the funds.
    * @return A uint specifying the amount of tokens still available for the spender.
    */
    function allowance(address _owner, address _spender) public constant returns (uint remaining) {        return allowed[_owner][_spender];
    }
}/**
 * @title Pausable
 * @dev Base contract which allows children to implement an emergency stop mechanism.
 */contract Pausable is Ownable {
  event Pause();
  event Unpause();  bool public paused = false;  /**
   * @dev Modifier to make a function callable only when the contract is not paused.
   */
  modifier whenNotPaused() {    require(!paused);
    _;
  }  /**
   * @dev Modifier to make a function callable only when the contract is paused.
   */
  modifier whenPaused() {    require(paused);
    _;
  }  /**
   * @dev called by the owner to pause, triggers stopped state
   */
  function pause() onlyOwner whenNotPaused public {
    paused = true;
    Pause();
  }  /**
   * @dev called by the owner to unpause, returns to normal state
   */
  function unpause() onlyOwner whenPaused public {
    paused = false;
    Unpause();
  }

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
区块链
云链聚未来,协同无边界。腾讯云区块链作为中国领先的区块链服务平台和技术提供商,致力于构建技术、数据、价值、产业互联互通的区块链基础设施,引领区块链底层技术及行业应用创新,助力传统产业转型升级,推动实体经济与数字经济深度融合。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档