Building Trading Bots Using Java [2016]
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
- 2020-12-07下载
- 积分:1
《数字信号处理C语言程序集》 殷福亮 宋爱军
一本非常有用的书:数字信号处理C语言程序集,作者 殷福亮,宋爱军。清晰、完整。网上提供的有些版本残缺不全,存在漏页的情况,我上传的这个经仔细检查,不存在类似问题。本书内容十分丰富,紧贴工程应用实际,非常实用。提供了大量的函数及其源代码,利于读者参考。实在是不可多大的一本好书,你值得拥有!本书的具体内容不在此赘述,大家很容易百度得到的。图书在版编目(CIP)数据数字信号处理C语程序集/殷福亮、宋爱乍主编,-沈阳:辽宁科学学技术出版社,1997.7ISBN7-5381-25213数殷…Ⅲ.C语言-数学信号-信号处理应用程序Ⅳ.TN没1.72中国版本图书馆CIP数据核字(97)第03286号辽宁科学技术出版社出版沈阳市和平区北马路1(8号邮政编码110001)地方国营新民印刷总厂印刷新华书店北京发行所发开本:787×10921/16印张:28字数:710.0001997年7月第1版1997年7月第1次印刷责任编辑:马旭东版式设计:于浪封面设计;邹君文责任校对:东戈印数:15,0(0定价:30.00元目录第一篇常用数字信号的产生第一章数字信号的产生§1.1均匀分布的随机数baaa‘·aa·a··‘s4···‘44‘4··44·····4··-···§1.2正态分布的随机数…§1.3指数分布的随机数…………·······◆÷·············:§1.4拉普拉斯( Laplace)分布的随机数单·鲁。非号。非●着鲁鲁导●·。香§1.5瑞利( Rayleigh)分布的随机数……………………………………9§1.6对数正态分布的随机数………:11§L.7柯西( Cauchy)分布的随机数………·…·.13§1.8韦伯( Weibul)分布的随机数……15§1.9爱尔朗( Erlang)分布的随机数………………17§1.10贝努里( Bernoulli1)分布的随机数………●看鲁ψ鲁曹●自●喜鲁。由看看自命曲D自看19§1.11贝努里高斯分布的随机数·●中·······甲§1.12二项式分布的随机数……§1.13泊松( Poisson)分布的随机数§1·14ARMA(pq)模型数据的产生命●·p·看D●·看·。普。··●曲也。b§1.15含有高斯白噪声的正弦组合信号的产生…………§1.16解析信号的产生………35第二篇数字信号处理第一章快速傅立叶变换…"39§1.1离散傅立叶变换……§1.2快速傅立叶变换鲁鲁··音····着·D。·协。中·咖4卡4●音备·由画口省画曲命··44§1.3基4快速傅立叶变换………●4bb●■·即·●··。···鄂甲,银●看§1.4分裂基快速傅立叶变换………………………………57§1·5实序列快速傅立叶变换(-)….°°··.·····“···。61§1.6实序列快速傅立叶变换(二)……§1.7用一个N点复序州的FFT同时计算两个N点实序列离散傅立叶变换…。b自4血者b自晶。aa·70§I.8共轭对称序列的快速傅立叶反变换73§1.9紊因子快速傅立叶变换…………………………………………80§1.10 Chirp乙-变换算法…………………………………96第二章快速离散正交变换…§2.1快速哈特莱( Hartley)变换…………………………§2.2基4快速哈待莱( Hartley)变换§2.3分裂基快速哈特莱( Hartley)变换…§2.4快速离散余弦变换……15§2.5快速离散余弦反变换…………····自··非·中中····曹...·.118§2.6N=8点快速高散余弦变换·······…··…·121§27N=8点快速离散余弦反变换●鲁鲁·香垂香●鲁§28快速离散正弦变换…………………………129§2.9快速沃尔什( Walsh)变换…133§2.10快速希尔伯特变换(一)………………鲁·鲁音辛章·看·争●·●自章·自··137§2.11快速希尔伯特变换(二)…141第三章快速卷积与相关§3.1快速卷积………………………144§3.2长序列的快速卷积……………………147§33特别长序列的快速卷积…中4·鼻●………………∵"……152§3.4快速相关…………………………………………………158第四章数字滤波器的时城和频域响应…………16341数字滤波器的频率响应b●4,4看香·……163§4.2级联型数字滤波器的频率响应………………………166s4.3数字滤波器的时域响应171§4.4直接型IR数字滤波(一)………………………………174§4.5直接型IR数字滤波(二)…………177§4.6级联型IR数字滤波§4.7并联型IR数字滤波…………………………………………185第五章IR数宇滤波器的设计………………………………189§5.1巴持沃兹和切比雪夫数字滤波器的设计……◆香音非杳D,看看§5.2任意幅庋IR数字滤波器的优化设计……………………………2082第六章FIR数字滤波器的设计……………………………227§6.1窗函数方法………………………………………227§6.2频域最小误差平方设计………238§6.3切比雪夫通近方法…………………………………242第三篇随机数字信号处理第一章经典谱佔计···:·a4a命a4264§1.1功率谱估计的周期图方法264§1.2功率谱估计的相关方法………………………………………271第二章现代谱佔计隐自·音鲁章自●·●4鲁自费●●看§2.1求解一般托布利兹方程组的莱文森算法……………………280§2.2求解对称正定方程组的乔里斯基算法…83§2.3求解尤利沃克方程的莱文森德宾算法§2.4计算ARMA模型的功率谱密度……………………………….289§2.5尤利沃克谱估计算法…………292§2.6协方差谱估计算法.·…·…297§2.7Burg谱估计算法30§2.8最大似然谱估计算法鲁t···章·。看e308第三章时频分析………….314§3.1维格纳( wigner)分布……………◆鲁毋■章鲁·●●·●非b曲。島曲…314§3.2离散小波变换…318第四章随机信号的数字滤波330§41维纳( Wiener)数字滤波…唱·喜非最330§42卡尔曼( Kalman)数字滤波…·。··●··命···◆··命·335§4.3最小均方(LMS)自适应数字滤波………341§44归一化LMS自适应数字滤波344§4.5递推最小二乘(RLS)自适应数字滤波……………………348第四篇数字图像处理第一章图像基本运算………………ss"sss352§1·1图像读取、存储与显示…§1.2图像旋转….·····鲁具··。366§1.3图像灰度级直方图的计算…………368§1.4图像二值化的固定阀值法…1.5图像二值化的自适应阀值法…·中··看辛中·鲁音·甲●·372第二章图像增强-………376§2.1图像直方图均衡…………………………376§2.2中值滤波香看春·鲁自。看●··….·········色·.···B···378§2.3图像锐化······.···········世·D“·中·中···中·;··容e·咱要382§2.4图像平滑………………………………………………………………383第三章图像边缘检测辛b鲁卡鲁中●●·§31 Roberts算子边缘检测“····.…·386§3.2拉普拉斯算子边缘检测…………………………………388§3.3 Sobel算子边缘检测………§3.4 Robinson算子边缘检测………………………392§3.5 Kirsch算子边缘检测…鲁鲁·看§3.6 Prewitt算子边缘检测第四章图像细化……………………………………………139§4.1 Hilditch细化算法看●看非。●命D看鲁●●;·着●画399§4.2 Pavlidis细化算法qq··中····.404§4.3 Rosenfeld细化算法………第五篇人工神经网络第一章神经网络模型……·…·…"·416§1.1多层感知器神经网络………………………………………………416§1.2离散 Hopfield神经网络……………………………………425§1.3连续 Hopfield神经网络……。辛b4··吾。自司b命°…·434§1.4Tank- Hopfield线性规划神经网络参考文献…●●●电·单·4是p中······鲁s自····4·●……………”442第一篇常用数字信号的产生第一章数字信号的产生§1.1均匀分布的随机数功能产生(a,b)区间上均匀分布的随机数、方法简介均匀分布的概率密度函数为,a≤x≤b0,其它通常用U(2)表示,均匀分布的均值为+2,方差为(b2产生均匀分布随机数的方法如下:首先,由给定的初值x,用混合同余法ai=(ai-1+ c)(mod M)产生(0,1)区间上的随机数y。其中a=2045,c=1,M=20;然后,通过变换x;=a(b-a)y产生(ab)区间上的随机数z三、使用说明1.子函数语句double uniform (a.b. seed)2.形参说明a—双精度实型变量。给定区间的下限。b—双精度实型变量。给定区间的上限seed—长整型指针变量。*seed为随机数的种子。四、子函数程序(文件名: uniform.c)double uniform (a, b, seed)ouble ai doubled=2045兴(兴seed)+1Seed=关seed一(兴seed/1048576)为1048576;t=(兴seed)/1048576.0;t=a-(beturn (t)五、例题产生50个0到1之间均匀分布的随机数。主函数程序(文件名: uniform.m):#include " stdio. h# includi double a, bngdouble uniform(double, double, long int *a=0.0;b-1.0;s=13579for(i=0;
- 2020-12-06下载
- 积分:1