登录
首页 » Others » Building Trading Bots Using Java [2016]

Building Trading Bots Using Java [2016]

于 2020-12-07 发布
0 300
下载积分: 1 下载次数: 0

代码说明:

Building Trading Bots Using JavaEnglish | 6 Jan. 2017 | ISBN: 1484225198 | 300 Pages | PDF | 6.22 MBBuild an automated currency trading bot from scratch with java. In this book, you will learn about the nitty-gritty of automated trading and have a closer look at Java, the Spring Framework, event-Building Trading Bots Using Javahekhar VarshneyGrangesSwitzerlandISBN13(pbk):978-1-4842-2519-6ISBN-13(electronic): 978-1-4842-2520-2DOI10.1007/978-1-4842-2520-2Library of Congress Control Number: 2016961228Copyright o 2016 by Shekhar VarshneyThis work is subject to copyright All rights are reserved by the Publisher, whether the wholeor part of the material is concerned, specifically the rights of translation, reprinting, reuse ofillustrations, recitation, broadcasting, reproduction on microfilms or in any other physicalway, and transmission or information storage and retrieval, electronic adaptation, computersoftware, or by similar or dissimilar methodology now known or hereafter developedTrademarked names, logos, and images may appear in this book. Rather than use a trademarksymbol with every occurrence of a trademarked name, logo, or image we use the names, logos,nd images only in an editorial fashion and to the benefit of the trademark owner, with nointention of infringement of the trademarkThe use in this publication of trade names, trademarks, service marks, and similar terms, even ifthey are not identified as such, is not to be taken as an expression of opinion as to whetheror notthey are subject to proprietary rightsWhile the advice and information in this book are believed to be true and accurate at thedate of publication, neither the authors nor the editors nor the publisher can accept any legalresponsibility for any errors or omissions that may be made. The publisher makes no warranty,express or implied, with respect to the material contained hereinManaging Director: Welmoed SpahrLead Editor: Steve AnglinEditorial Board: Steve Anglin, Pramila Balan, Laura Berendson, Aaron Black, Louise Corrigan,Jonathan gennick, Robert Hutchinson, Celestin Suresh John, Nikhil KarkalJames Markham, Susan McDermott, Matthew Moodie, Natalie Pao, Gwenan SpearingCoordinating Editor: Mark PowersCopy Editor: Kezia EndsleyCompositor: SPi GlobalIndexer: SPi GlobaArtist: SPi GlobalDistributed to the book trade worldwide by Springer Science+ Business Media New York,233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax(201)348-4505e-mailorders-ny@springer-sbm.comorvisitwww.springeronline.com.ApressMedia,Llcisa California LlC and the sole member(owner) is Springer Science Business Media FinanceInc(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporationForinformationontranslationspleasee-mailrights@apress.comorvisitwww.apress.comApress and friends of ed books may be purchased in bulk for academic, corporate, or promotionaluse eBook versions and licenses are also available for most titles For more information referenceourSpecialbUlkSales-ebookLicensingwebpageatwww.apress.com/bulk-salesAny source code or other supplementary materials referenced by the author in this text areavailabletoreadersatwww.apress.com.Fordetailedinformationabouthowtolocateyourbookssourcecodegotowww.apress.com/source-code/.ReaderscanalsoaccesssourcecodeatSpringerlink in the Supplementary Material section for each chapter.Printed on acid-free paperedicated to the angels in my lifemy mother, my wife Preshita, and my two daughters Mihika and anyaLast but not the least, my college professor, Dr. Rajat Moona,who sowed the seeds of computer programming in my dnaContents at a glanceAbout the authorChapter 1: Introduction to Trading Bota.Chapter 2: Account Management27Chapter 3: Tradeable Instruments47Chapter 4: Event Streaming: Market Data EventsChapter 5: Historic Instrument Market Data aeEERaar75Chapter 6: Placing Orders and trades97Chapter 7: Event Streaming: Trade/Order/Account Events159Chapter 8: Integration with Twitter aamna■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■175Chapter 9: Implementing Strategies.am.203Chapter 10: Heartbeating ammmmmmmmmmmn 219Chapter 11: E-Mail Notifications ammmmatmmammmmmmmnmamman 231Chapter 12: Configuration, Deployment, and Running the Bot 243Chapter 13: Unit Testing■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■口■■■■■263Index…277ContentsAbout the author,i币Chapter 1: Introduction to Trading Bot m mmmemmIRD■■■■■■■■■■■■■■■■■■■■■■■■■What Is a Trading Bot?Why do We need a trading bot?...3The capabilities of the Trading BotDesign goalsCode organization and software Stack Used .OANDA REST API as Reference Implementation.m....ammann. 8Opening an oanda practice Account80 ANDA JS0 N Keys…………Constructor Dependencies for OANDA Implementations15Event-Driven architectureG0 ogle eventBus…18Provider helper Interface20Trading Config class.........mmonann......mtnonnn.......tnn 22Obtaining the Source Code.aaeeaaaee... 24Try It Yourself section..aaaaaa.. 24Chapter 2: Account Managementa27Account provider interface31A Concrete Implementation for AccountDataProvider32Encapsulating Everything Behind a Generic AccountlnfoService37Try It yourself43VIlCONTENTSChapter 3: Tradeable Instruments47InstrumentA Concrete Implementation for InstrumentDataProvider52Encapsulating Everything Behind a Generic Instrumentservice56Try It yourself58Chapter 4: Event Streaming: Market Data Events mmmmmmmmmm. 61Streaming Market Data Interface.A Concrete Implementation for MarketData StreamingService .m..63Downstream Market data event disseminationMarketEventcallback……69Try It Yourself,…70Chapter 5: Historic Instrument Market Data mmmmmmmm 75How to read a candlestick75Enum Defining the Candlestick Granularity76Define pojo to hold candlestick information77Historical Data Provider Interface79A Concrete Implementation for HistoricMarketDataProvidern81Discussion An Alternate Database Implementation85Candlesticks for Moving Average Calculations....88MovingAverage calculation Service89Try lt YourselfChapter 6: Placing Orders and Trades■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■97Order pojo definition98Order Management provider Interface101A Concrete Implementation for Order ManagementProvider,103A Simple orderInfoService,115CONTENTSValidating Orders Before Execution: PreOrderValidationService... 116Putting It All Together in an OrderExecution Service .mmmm... 121Trade pojo definition124Trade Management provider Interface127A Concrete Implementation for TradeManagementProvider129Encapsulating Read Operations Behind TradelnfoService.....m. 136Try It yourself144Chapter 7: Event Streaming: Trade/order/Account Events m 159Streaming Event Interface161A Concrete Implementation for Events StreamingService162Try It Yourself171Chapter 8: Integration with Twitter■■■■■■■■■■■■■■■■■■■■175Creating a Twitter Application175Spring Social180Using and Configuring Spring Social180Harvesting FX Tweets181Tweetharvester Interface wmmm. 185XTWeethandler Interface,,,………AbstractFxtweethandler base class186User-Specific TweetHandlersTry lt Yourself.Chapter 9: Implementing Strategies.aa203Copy Twitter Strategy204Fade the Move Strategy210Try It Yourself214CONTENTSChapter 10: Heartbeating ammammmmmmmmmmmmmmm 219HeartBeatPayload. ..m......m. 219Streaming the Heartbeat Interface220A Concrete Implementation for HeartBeatstreamingService221HeartBeatcallback Interface223DefaultheartBeatservice223Try It Yourself226Chapter 11: E-Mail notifications n231Notification Design.EmailPayLoad poJoEmailContentgenerator interface……232Sample Implementations.EventEmailNotifier service mm...m. 235Try It Yourself.237Chapter 12: Configuration, Deployment, and running the bot m 243Configuring the Trading Bot243Core Beans configuration244Twitter-Related Beans Configuration.....................247Provider Beans Configuration248Strategies configuration…254Services Configuration254Building the Bot...,,,,,…,,……256Running the bot.....,,……259CONTENTSChapter 13: Unit Testinga263Using Mockito as a Mocking Framework.Mocking Http iNteraction..............m....................e........................ 264Mocking Streams.The versatile verify Mockit0…....,.,,…271Mocking Twitter Interaction .EclEmma Code Coverage Tool for Eclipse ide.nDDDDDDDDDm274Index■■■■■■■■■■■■■■■■■■■口En277

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 傅里叶变换
    本程序是基于matlab编写的快速傅里叶变换的代码,程序可完美运行,仅供完成课堂作业参考,有需要改进的地方请指出。傅里叶变换(FT, Fourier Transform)的作用是将一个信号由时域变换到频域。其实就是把数据由横坐标时间、纵坐标采样值的波形图格式,转换为横坐标频率、纵坐标振幅(或相位)的频谱格式。变换后可以很明显地看出一些原先不易察觉的特征。
    2019-03-27下载
    积分:1
  • 百度文库PDF爬虫
    一个基于Python的百度文库爬虫,主要实现文库pdf文件的下载。
    2020-11-28下载
    积分:1
  • 六轴机械臂正解(FK)和逆解(IK)算法
    整理出了如下几个计算六轴机械臂正解和逆解的关键点:01_机器人坐标系和关节的说明02_算法坐标系的建立03_D-H参数表的建立04_FK(正解)算法05_Matlab辅助计算FK(正解)06_IK(逆解)算法07_Matlab辅助计算IK(逆解)文档中针对FK以及IK算法的推导均有详细的推导过程。希望各位能根据推导过程写出自己的代码。图1针对机器人的关节坐标系,我们还需要规定各个关节的转动方向,如下图所示,我们依次描叙了各个关节的正负方向。在关节坐标系下,机器人各个关节的转动方向,必须和下图相符图22.机器人直角坐标系目前所说的直角坐标系是机器人的工具坐标系,如下图所示,因为该机器人没有安装执行末端,所以,工具坐标系原点在第六轴末端法兰中心处,红色箭头是Ⅹ轴,蓝色箭头是乙轴,根据右手定则确定Y轴方向@图3基坐标系所在的位置是定义机器人基座的位置,如上图所示,坐标系原点在第一关节的中心处,红色箭头所示为Ⅹ轴,蓝色箭头所示为乙轴,根据右手定则,即可确定Y轴的方向。具体如上图旁边那个坐标系所示。当我们说六轴机械臂位姿时,说的是六轴机械臂末端的位姿,该位姿包括六个参数,分别为Ⅹ YZABC。六轴机械臂未端的位姿是以基坐标系作为参考坐标系的:笛卡尔坐标系的Ⅹ轴,Ⅹ轴距离Y:笛卡尔坐标系的Y轴,Y轴距离Z:笛卡尔坐标系的Z轴,z轴距离A:XY-Z固定角坐标系下的偏转角B:X-Y-Z固定角坐标系下的俯仰角C:XY-Z固定角坐标系下的回转角ZA2呈Ax图如上图所示,A对应第一个坐标系中的γ,B对应第二个坐标系中的β,C对应第三个坐标系中的Q。为什么我们需要花费专门的一节来讲解六轴机器人的坐标系和关节?因为我们后续要学习的FK和就是以这个为基础的。FK是已知六轴机械臂在关节坐标系下各个关节转动的角度,然后求解直角坐标系下的Ⅹ YZABOK是已知六轴杋械臂在直角坐标系下的 XYZABO,然后求解关节坐标系下各个关节转动的角度二.算法坐标系的建立为了得出D-H参数表,我们首先需要针对六轴机器人的各个关节建立坐标系,在固定的坐标系下,才能最终得出连杆之间的变换关系,从而建立D-H参数表。82个2算法坐标系确定的通用方法如下1)坐标系的Z轴,与各个关节的旋转中心轴线重合2)坐标系的X轴,与沿着相邻两个z轴的公垂线重合3〕坐标系的Y轴,可以通过右手定则来确定当相邻两个z轴相交时,确定坐标系的方法如下1)坐标系的Y轴,沿着第一个Z轴与下一个z轴相交的延长线为Y轴2)坐标系的Ⅹ轴,通过右手定则确定当相邻两个Z轴平行时,确定坐标系的方法如下1)坐标系Ⅹ轴,相邻两个乙轴平行,做两个乙轴的公垂线,相交于下一个z轴为Ⅹ轴,方向为第一个Z轴到下一个Z轴的方向2)坐标系Y轴,通过右手定则确定三.D-H参数表的建立D-H参数表,实际上是相邻各个关节坐标的变换关系表,根据之前针对各个关节所建立的丛标系,按照如下四条变换规则,即可得到D-H参数表。变换规则1)绕Z轴,旋转9n+1n与Xn+1平行(方向一致))沿Zn轴,平移与Xn+1共线3)沿Xn轴,平移aAn与Xn+1原点重4)将Zn绕Xn+1轴,旋转αn+1Zn与Zn+1共线建立D-H参数表的详细步骤第一步,从第一关节到第二关节之间的变换绕z轴,旋转0度,让X0与X1平行且方向一致沿z轴,平移242,让Ⅺ0与X1共线沿Ⅺ轴,平移0,Ⅺ与X1原点重合将石绕X1轴,旋转90度,Z0与z1共线第二步,从第二关节到第三关节之前的交化绕z1轴,旋转90度,让X1与X2平行且方向一致沿Z1轴,平移0,让X1与X2共线沿X1轴,平移225,X1与X2原点重合将Z1绕X2轴,旋转0度,Z1与Z2共线第三步:从第三关节到第四关节之间的交换绕z2轴,旋转0度,让X2与X3平行且方向一致沿Z2轴,平移0,让Ⅹ2与X3共线沿X2轴,平移0,X2与X3原点重合将Z2绕X3轴,旋转90度,Z2与z3共线第四步:从第四关节到第五关节之间的变换绕z3轴,旋转0度让X3与X4平行且方向一致沿3轴,平移22886,让X3与X4共线沿3轴,平移0,X3与X4原点重合将Z3绕X1轴,旋转90度,Z3与Z1共线第五步:从第五关节到第六关节之间的变换绕Z4轴,旋转90度,让X4与X5平行且方向一致沿Z4轴,平移0,让X4与X共线沿X轴,平移0,X1与K5原点重合将Z4绕X5轴,旋转90度,Z4与z共线第六步:从第六关节到未端之间的变换绕z轴,旋转0度,让X5与X6平行且方向一致沿z轴,平移-50,让X5与X6共线沿X轴,平移0,X5与K6原点重合将z绕X轴,旋转0度,Z5与z6共线根据上图所示机械臂的尺寸参数以及以上六个步骤的变换,D-H参数表如下所示420901-202253-4228.864-5900900-500四.正解(FK)算法根据连杆变换规贝T=R(Z, B1*T(Z, di)*T(X, ai)*R(X, ai)6;00因为R(Z06:00100000aT(Z,a1)=00001000011000T(xa10100001d0001000 caROX. a)= osa oa;0001根据以上矩阵变换,可以得到如下连杆变换的通用矩阵如下Bi -se, ca s0,sa, a,c61s0 ce:cad sa asa0 saca d00根据以上连杆变换的通用矩阵和之前的D-H参数表,可以得到如下δ个连杆变换矩阵e10s61^0S0 0T6100102420001s20-22S620225c62000001620s60b203001000040s日4000c0 0010228.860001s50c650C650s650000006-s6006000C001-40FK算法需要解决的问题是:已知各个关节的转动角度,需要求出末端的位姿。已知:(61,2,θ3,θ4,θs,θ6求解:(X,Y,乙,A,B,C)计算公式如下所示13机器末端的位姿矩阵为72272313273300011722723py07*1T2T*37*4T5Tp000在以上的推导过程中,、T、2、37、4、7分别为相对于01、02、63、64、6s、的已知量。由此可以求解出位置变量(pPP)以及姿态变量a1T2723五. Matlab辅助计算正解(FK)根据上一章,我们有如下结论10s10100102420001s2-c620-225s6CS20225C60010
    2020-12-05下载
    积分:1
  • 三相桥式有源逆变仿真
    三相有源逆变仿真 matlab仿真simulink仿真实验
    2020-12-05下载
    积分:1
  • enframe语音信号处理分帧matlab分帧函数
    求语音信号特征时必用的分帧函数,直接调用matlab工具箱运用,function函数,自定义函数。
    2020-12-09下载
    积分:1
  • numpy-1.13.1+mkl-cp36-cp36m-win_amd64.whl
    numpy-1.13.1+mkl-cp36-cp36m-win_amd64.whl Install numpy+mkl before installing scipy.
    2020-11-30下载
    积分:1
  • MDK 配色工具(内置14种配色方案)
    用于Keil mdk配色方案自动更换和还原,省得一行一行的代码编写过程,太费劲了。您也可以直接复制过去,效果是一样的。
    2020-12-08下载
    积分:1
  • STM32F103C8T6最小系统PCB+原理图+3D库
    用Altium designer打开,里面有STM32F103C8T6最小系统的PCB,有库文件原理图也有
    2020-11-28下载
    积分:1
  • R/S分析matlab代码
    R/S分析的MATLAB代码,可以用于确定Hurst指数,借助、可以估计自相关系数指数、谱指数和分维等
    2020-12-10下载
    积分:1
  • RV1108开发板资料
    【实例简介】rv1108开发板资料 原理图和PCB文档 ALLEGRO格式
    2021-11-01 00:31:13下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载