Giter VIP home page Giter VIP logo

flashfunk's Introduction

FlashFunk

High Frequency Trading Framework

为什么选择Rust

速度快 安全 写的爽

任务队列

  • fix backtest and add test.

  • ctp里面的代码替换到flashfunk-interface

  • 測試覆盖

  • 日志

  • 移除所有警告以及修复clippy错误

接口编译

本项目最终采用rust-indgen 作为c++接口封装

如何安装

参见 Install

系统要求

  • linux 提供了安装教程

  • windows 需要安装llvm环境, 自行折腾 ~~

简单上手

无须你处理任何事情 专注写策略即可 我们已经为你实现绝大部分功能, 唯一需要你关注的是如何写出赚钱的策略

use chrono::{Local, NaiveDateTime, Timelike};

use flashfunk_core::constants::{Direction, Offset, Exchange, OrderType, Status};
use flashfunk_core::interface::Interface;
use flashfunk_core::structs::{CancelRequest, Generator, LoginForm, OrderData, OrderRequest, TickData};
use flashfunk_core::prelude::{Ac, IntoStrategy, Context, ContextTrait, Flash};
use flashfunk_core::ctp::md_api::MdApi;
use flashfunk_core::ctp::td_api::TdApi;
use flashfunk_codegen::Strategy;

#[derive(Strategy)]
#[name("flash_ni")]
#[symbol("ni2102")]
pub struct Collector{
    ticks: Vec<TickData>
}

impl Ac for Collector {
    fn on_tick(&mut self, tick:&TickData, ctx: &mut Context){
        println!("{} {}", tick.datetime, tick.last_price);    
    }   
    
    fn on_order(&mut self, order: &OrderData, ctx: &mut Context){
        // get your order back infomation   
    }   

}

fn main() {
    // build a strategy instance 
    let tor = Collector {
            ticks: vec![]
    };
    // get the login infomation
    let login_form = LoginForm::new()
        .user_id("089131")
        .password("350888")
        .broke_id("9999")
        .app_id("simnow_client_test")
        .md_address("tcp://180.168.146.187:10131")   // simnow24小时环境
        .td_address("tcp://180.168.146.187:10130")
        // .md_address("tcp://218.202.237.33:10112")  // simnow移动正常环境
        // .td_address("tcp://218.202.237.33:10102")
        .auth_code("0000000000000000")
        .production_info("");
    
    // build running environment to run strategy and start
    Flash::builder::<MdApi, TdApi, _>("flash")
        .strategies(vec![tor.into_str()])
        .id("flash")
        .login_form(login_form)
        .start();
}

flashfunk's People

Contributors

duckquant avatar fakeshadow avatar qzm avatar somewheve avatar thesupermyo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.