sun0x00 / redtorch Goto Github PK
View Code? Open in Web Editor NEWKotlin(Java)开源量化交易开发框架
Home Page: http://redtorch.io
Kotlin(Java)开源量化交易开发框架
Home Page: http://redtorch.io
在GatewayAbstract的代码中看到FastEvent的event与eventType用的都是一样的值,那么event与eventType的区别是什么呢?为什么要设计两个字段呢?
1.项目还在更新
2.接下来的变动比较大,会采用进程解耦,以便于提高策略调试效率
3.界面会重写,可能会降低刷新速率,比如从实时降低为500ms,但提高巨量数据下的稳定性,提高视觉效果和低分辨率兼容性
4.Gateway接口将会拆分为行情MD和交易TD
5.更新时间待定。。预计10月8日之前
登录成功后,右上角一直提示警告: 服务器关闭或Token已过期,请尝试刷新页面登录
预计今晚(2018年8月1日)发布,稍安勿躁
是否支持运行在mac下或者linux下
mongo 对于 Tick 这种类似时间序列的存储貌似不是很高效呢。
如果要存上两年以上的数据,mongo 的性能可能会有问题。
web页面服务端口为9099,socketio的端口为9098,为什么没有报跨域呢?我的其他项目正好有用到这块,想学习一下
建议作者可以把基础的模块固定后,发布的频率加快,遇到的问题大家也可以帮忙认领和一起解决。
如果我没理解错的话,CTP接口的订阅都需要有一个“容器”维护MdSpi与TdSpi对象的生命周期,而从源码我看到RedTorch用CtpGateway来维护,但却找不到是什么来维护CtpGateway对象。可否补充说明一下?
老版本是有的,新版本没有,麻烦补充。
此问题将会在2019-01 Beta版本修复,预计2019年1月15日之前。
浏览器不支持多线程,因此存在以下两种情况
当委托数据超过5000笔,首次连接接口会有明显的卡滞
日志数量超过8000笔,会造成页面卡死
定时刷新,数据仍然通过websocket推送至前端,前端通过定时器刷新,避免频繁刷新
使用React重构前端页面,根据功能进行拆解
导入项目,启动不了,提示如下:
2019-08-24 16:23:37.266 [main ] [WARN ] jsr >>> UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
我是win7操作系统,按照GitHub文档步骤安装,
1,安装MongoDB
2,安装vs2013x64运行库
3,安装JDK11 x64并设置环境变量(JAVA_HOME=C:\Java\jdk-11.0.2 ,PATH=%JAVA_HOME%\bin)
4,eclipse-jee-2019-06-R-win32-x86_64.zip
在Eclipse中使用File->Import->Existing Gradle Projects导入本项目
5,通过rt-node-master中的RtNodeMasterApplication.java启动主节点
启动主节点卡在这个问题,请不吝指教,那里步骤有问题,如何顺利项目运行?谢谢
再次run一下,提示如下:
. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )__ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' || .__|| ||| |_, | / / / /
=========||==============|/=////
:: Spring Boot :: (v2.1.5.RELEASE)
2019-08-24 16:34:32.423 [main ] [WARN ] jsr >>> UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2019-08-24 16:34:33.777 [main ] [ERROR] LoggingFailureAnalysisReporter >>>
APPLICATION FAILED TO START
Description:
Web server failed to start. Port 9099 was already in use.
Action:
Identify and stop the process that's listening on port 9099 or configure this application to listen on another port.
软件使用过程中总会有各种各样的异常,而做为最后一步保�命的手段,我觉得“全部平掉”应该是一个一下就可以保命的东西。
然后没有这样一个命令,比如:
所有的这些,都是程序擅长的事情,所以如果有一个“一键全平”的功能,可以在最关键的时候救一命,不然到时手忙脚乱,就不好搞了。
OnRspQryDepthMarketData 返回的结果中,好几个double类型都是无穷大,例如rb1810, 20180620的getClosePrice()就是无穷大,请是不是生成的dll文件有关。
有几个安全隐患,希望考虑一下
java.lang.UnsatisfiedLinkError: /private/tmp/xyz/redtorch/api/jctp/lib/libthostmduserapi.so: dlopen(/private/tmp/xyz/redtorch/api/jctp/lib/libthostmduserapi.so, 1): no suitable image found. Did find:
/private/tmp/xyz/redtorch/api/jctp/lib/libthostmduserapi.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
/private/tmp/xyz/redtorch/api/jctp/lib/libthostmduserapi.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
在过去的一段事件中很多朋友反映操作界面不够友好,无论是交互逻辑还是视觉感受,经过一段时间的总结,目前认为主要有两个方面原因,一是Ant Design字号过大,界面空间利用率不足,二是局限于单个html页面。除此之外,dva的开发模式过于复杂,学习成本太高,函数命名混乱,不利于推广和二次开发。因此接下来考虑采用MobX替换Dva,使用Microsoft Office UI Fabric统一UI样式开发Web App。同时推进使用Electron开发的统一样式的支持多窗口的Desktop App。
在CtpGateway.class中,有这样一个TimerTask:
`class QueryTimerTask extends TimerTask{
@Override
public void run() {
try {
if(isConnected()) {
queryAccount();
}
Thread.sleep(1250);
if(isConnected()) {
queryPosition();
}
Thread.sleep(1250);
}catch (Exception e) {
log.error(gatewayLogInfo+"定时查询发生异常",e);
}
}
}
这个定时任务的执行,仅仅休眠就有2500ms,没有加上执行查询的耗时。 而这个任务执行的间隔仅仅1000ms:
timer.schedule(new QueryTimerTask(), new Date(), 1000);`
这会导致任务队列大量堆积,不知这是一个问题,还是特意如此设计?
能否请作者解答一下?
能做成动态插入的形式就好了,技术上,还没太想好怎么实现。
dev branch好像不能排序,找一个合约比较困难。
目前正在使用redTorch实现一个用于币圈的量化交易. 但是在实现过程中发现现有接口的耦合度太高了,很难定制实现自己的业务逻辑, 希望作者予以改进,谢谢.
建议:
方案1: 直接使用spring的依赖注入方式实现接口与实现代码的绑定.
方案2: 使用Factory模式创建一个工厂类,统一初始化各个接口的实现.
``
diff --git a/src/main/java/xyz/redtorch/trader/base/BaseConfig.java b/src/main/java/xyz/redtorch/trader/base/BaseConfig.java
index 293ee63..e6da1f1 100644
--- a/src/main/java/xyz/redtorch/trader/base/BaseConfig.java
+++ b/src/main/java/xyz/redtorch/trader/base/BaseConfig.java
@@ -1,9 +1,13 @@
package xyz.redtorch.trader.base;
+import java.net.MalformedURLException;
+import java.net.URL;
+
import org.apache.commons.configuration2.CompositeConfiguration;
import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
import org.apache.commons.configuration2.builder.fluent.Parameters;
+import org.apache.commons.configuration2.builder.fluent.PropertiesBuilderParameters;
import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.slf4j.Logger;
@@ -16,19 +20,56 @@
public static CompositeConfiguration rtConfig;
static {
rtConfig = new CompositeConfiguration();
try {
FileBasedConfigurationBuilder<PropertiesConfiguration> builder =
new FileBasedConfigurationBuilder<PropertiesConfiguration>(PropertiesConfiguration.class)
.configure(new Parameters().properties()
.setFileName("RtConfig.properties")
.setThrowExceptionOnMissing(true)
.setListDelimiterHandler(new DefaultListDelimiterHandler(';'))
.setIncludesAllowed(false));
PropertiesConfiguration propertiesConfiguration = builder.getConfiguration();
rtConfig.addConfiguration(propertiesConfiguration);
} catch (ConfigurationException e) {
log.error("配置文件RtConfig.properties加载失败",e);
throw new Error("配置文件RtConfig.properties加载失败");
}
PropertiesBuilderParameters params = new Parameters().properties()
.setThrowExceptionOnMissing(true)
.setListDelimiterHandler(new DefaultListDelimiterHandler(';'))
.setIncludesAllowed(false);
if(!tryConfig(params,"file:./config/RtConfig.properties"))
{
if(!tryConfig(params,"file:./RtConfig.properties"))
{
if(!tryConfig(params,"classpath:/config/RtConfig.properties"))
{
if(!tryConfig(params,"classpath:/RtConfig.properties"))
{
log.error("配置文件RtConfig.properties加载失败");
throw new Error("配置文件RtConfig.properties加载失败");
}
}
}
}
try {
URL configFileUrl = new URL(config_url_txt);
FileBasedConfigurationBuilder<PropertiesConfiguration> builder =
new FileBasedConfigurationBuilder<PropertiesConfiguration>(PropertiesConfiguration.class)
.configure(params.setURL(configFileUrl));
PropertiesConfiguration propertiesConfiguration = builder.getConfiguration();
rtConfig.addConfiguration(propertiesConfiguration);
return true;
} catch (ConfigurationException e) {
log.debug("配置文件RtConfig.properties加载失败",e);
return false;
}catch (MalformedURLException e)
{
log.debug("配置文件RtConfig.properties加载失败",e);
return false;
}
在项目正常启动后,通过web页面添加一个网关后点击连接,假如此时所填写的密码错误,目前项目会一直在循环的进行登录,CTP返回 交易接口登录回报错误 错误ID:3,错误信息:CTP:不合法的登录 ,最终会出现 交易接口登录回报错误 错误ID:75,错误信息:CTP:连续登录失败次数超限,登录被禁止 。
是否可以做个登录失败次数的限制,请问这个问题如何解决,谢谢!
SpringApplication will load properties from application.properties files in the following locations and add them to the Spring Environment:
docs
A /config subdirectory of the current directory.
The current directory
A classpath /config package
The classpath root
所以只要在当前运行目录下,创建config目录,app;ication,properties 或者直接放在当前目录下,可以覆盖classpath里的properties文件。 RtConfig.properties 需要改下加载程序,这样也可以符合springboot的约定。logback.xml LOG_HOME无需指定盘符,会自动创建log目录。``
Chronicle-Queue 暂时不支持Java 11,因此不得不降级
❯ ./gradlew build
> Task :rt-strategy:compileTestJava FAILED
/private/tmp/RedTorch/rt-strategy/src/test/java/xyz/redtorch/startegy/backtesting/StrategyDemoBacktesting.java:15: error: package xyz.redtorch.core does not exist
import xyz.redtorch.core.CoreRunConfiguration;
^
/private/tmp/RedTorch/rt-strategy/src/test/java/xyz/redtorch/startegy/backtesting/StrategyDemoBacktesting.java:22: error: cannot find symbol
@SpringBootTest(classes = CoreRunConfiguration.class)
^
symbol: class CoreRunConfiguration
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':rt-strategy:compileTestJava'.
> Compilation failed; see the compiler error output for details.
比如initContractPositionMap里的contractSetting.getTradeGateways, dev分支里其实已经没有这个函数,期待早日更新~~
在建立连接后,springboot服务关闭
FastEvent 中Order Trade等对象都是预先New分配的,在CoreEngineServiceImpl类中onOrder方法直接使用 orderMap.put(order.getRtOrderID(), order);
缓存该Order。
这会导致如果RingBuf重复使用的时候, orderMap之前的order的值会被后续的事件给修改掉。虽然你目前缓存buf是65536 , 对于order没有类似问题, 但对于tick可能会有隐患。
一个很微小的改动,但是能够避免将来用户不同gradle版本的问题。gradle的best practice是用gradlew,其他知名的开源项目disruptor sbe等都是gradlew 谢谢~
2018-10-11 19:56:46.216 [main] INFO MongoDBServiceImpl >>> 加载Tick数据完成,合约rb1710.SHFE,共165590条,耗时131188ms
jdk1.8, -Xmx2g
当前系统存在耦合问题,当需要更新单个策略时,需要重启JVM,影响其他策略的正常运行。
计划采用mmap或socket等技术对这一部分内容解耦,策略运行时存在于单独的jvm实例。
平台和策略将实现分离。
❯ java -jar ./rt-front-web/build/libs/rt-front-web-0.1.war
顺利启动有如下的log
2018-11-21 09:50:41.113 [main] INFO Jdk14Logger >>> Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.114 [main] INFO Jdk14Logger >>> Mapped URL path [/**/*.css] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.114 [main] INFO Jdk14Logger >>> Mapped URL path [/**/*.html] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.114 [main] INFO Jdk14Logger >>> Mapped URL path [/**/*.js] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.114 [main] INFO Jdk14Logger >>> Mapped URL path [/**/*.jsx] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.114 [main] INFO Jdk14Logger >>> Mapped URL path [/**/*.png] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.115 [main] INFO Jdk14Logger >>> Mapped URL path [/**/*.ttf] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.115 [main] INFO Jdk14Logger >>> Mapped URL path [/**/*.woff] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.115 [main] INFO Jdk14Logger >>> Mapped URL path [/**/*.woff2] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.115 [main] INFO Jdk14Logger >>> Root mapping to handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.292 [main] INFO Jdk14Logger >>> Registering beans for JMX exposure on startup
2018-11-21 09:50:41.389 [main] INFO Jdk14Logger >>> Undertow started on port(s) 9099 (http) with context path ''
2018-11-21 09:50:41.393 [main] INFO Jdk14Logger >>> Started RtApplication in 3.675 seconds (JVM running for 4.091)
2018-11-21 09:50:41.394 [main] INFO SocketIOServer >>> Session store / pubsub factory used: MemoryStoreFactory (local session store only)
2018-11-21 09:50:41.558 [main] INFO SocketIOCommandLineRunner >>> SocketIO服务启动成功!
2018-11-21 09:50:41.558 [nioEventLoopGroup-2-1] INFO SocketIOServer$1 >>> SocketIO server started at port: 9098
但是 不能通过
http://127.0.0.1:9099/static/html/index.html 访问
有如下错误
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Nov 21 09:51:23 CST 2018
There was an unexpected error (type=Not Found, status=404).
Not Found
master branch 没问题
在用dev版订阅行情时出错:
2018-10-24 12:12:05.612 [Thread-1053] INFO MdSpi >>> 接口ID-[JjDiofQNRVSojS_J_QQJOg] 名称-[ctpdemo] >>> 行情接口错误回报!ErrorID:77,ErrorMsg:CTP:无此功能,RequestID:0,isLasttrue
因为登录不成功,有404错误。所以尝试在ZeusApplication中执行main函数,里面就是 SpringApplication.run(ZeusApplication.class, args);
执行出错:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zeusApplication': Unsatisfied dependency expressed through field 'tokenService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenServiceImpl': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'rt.web.username' in value "${rt.web.username}"
大佬呀,想学习一下你项目的设计和架构,有没有文档呀。 随便给点就好。
www.ibkr.com.cn
相关工作已经完成,进入实测阶段
test
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.