Performance in Go for trading bot.

xuanbao · · 392 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I&#39;m interested in making a small trading bot that will perform arbitrage on some markets for fun. While it&#39;s probably easier to quickly prototype something using Python, I figured that in the long term the performance of the actual bot is going to matter. Is it worth using Go over Python for this? Just from my guess, the actual performance is going to be network-bound instead of CPU bound (there&#39;s actually very few calculations required to check if a simple arbitrage is possible).</p> <hr/>**评论:**<br/><br/>GallantMorgan: <pre><p>It has been shown that Golang does execute faster than python in most instances (however not all). However, you would have to leverage performance for the libraries available in Python, especially for financial analysis and big numerical calculations. </p></pre>confusedemail: <pre><p>not sure if I understand correctly. you&#39;re saying that with high performance libraries, Python would adequate performance?</p></pre>GallantMorgan: <pre><p>Python provides a very dynamic and feature rich environment, especially with machine learning and mathematical libraries to perform calculations without much programmer overhead. Golang is slightly faster, but doesn’t currently have significant backing in terms of open source libraries (especially in financial computing). For this type of project, I would use Python as you would have access to a multitude of libraries like Numpy which will help you out.</p></pre>kjk: <pre><blockquote> <p>Golang is slightly faster</p> </blockquote> <p>Slightly? More like 10x faster than python (unless your python code actually is C code with python as a glue, which is the case for numpy).</p> <p>But pure Python vs. pure Go code, the speed difference is big.</p></pre>GallantMorgan: <pre><p>Raw performance yes, but using a library like Numpy or TensorFlow can bring Python to a comparable speed to Golang.</p></pre>jayjuicejay: <pre><p>Don&#39;t underestimate something like gonum in terms of a Numpy like library. There are many others in the Data Science field for Go that are up and coming.</p></pre>Redundancy_: <pre><p>If you end up doing a lot of network calls though, it&#39;s easier to do those concurrently on Go than Python 3.5 imo :)</p></pre>GallantMorgan: <pre><p>Good point</p></pre>int32_t: <pre><p>If you&#39;re going to implement a simulator for pilot run or backtesting, efficiency of CPU cycles would still be concerned. Also, I believe Go is better for unattended, long-running process when it comes to reliability. But Python is better if the task involves mainly interactive operations, where a REPL interpreter is clearly nicer than edit-compile-run.</p></pre>pubgftw: <pre><p>Also consider static vs dynamic typing. If runtime stability is important, Go has the edge due to more errors caught at compile time.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

392 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传