0

The C programming language outperforms interpreted languages such as Python or Ruby, but when it comes down to programming productivity, it is much easier/faster to write a Python program than a C program.

Considering that I want to write a trading bot, what would be the most appropriate language? If I use C, will I see a noticeable performance difference, or would the latency from HTTP calls make my decision time irrelevant?

closed as off topic by ripper234, lemonginger, Stéphane Gimenez, HedgeMage Sep 19 '11 at 17:25

Questions on Bitcoin Stack Exchange are expected to relate to Bitcoin within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    This is just a general programming question. It belongs on Stack Overflow, not here. – Chris Acheson Sep 15 '11 at 22:19
  • @Chris Acheson Maybe. But for example, MtGox has websockets which reduces latency a lot I think... I have no idea how other forex/stock exchanges work. If I went to stackoverflow I would have to write: "considering that I want to use the API from Bitcoin's exchanges...". – nmat Sep 15 '11 at 22:46
  • 1
    Then it's a question about websockets. Still a programming question. – Chris Acheson Sep 16 '11 at 2:26
  • 1
    Specifically, the reason it's off-topic is that this question could apply to any type of trading bot, Bitcoin or not. – eMansipater Sep 16 '11 at 15:43
2

No. The trades in Bitcoins just aren't that frequent. That is relevant to HFT in stocks, where there are many thousands of trades per second.

  • 1
    Thanks. All that talk about "renting the closest apartment to Wall-Street because of 10ms" got me thinking a lot about performance. – nmat Sep 16 '11 at 23:47
  • that is because you are literally banking on those extra ms to be able to arbitrage extremely tiny opportunities. (Same as those platforms between the US and UK.) cityam.com/wealth-management/the-optimal-locations-hft-systems – lemonginger Sep 17 '11 at 0:22
8

The latency for gathering information and executing decisions will swamp the performance difference between languages. That assumes you don't write horribly awful code, but you can do that in any language. You should use whatever language you are most proficient in or whichever one you find easiest for the task.

0

If you want to base your work on the original client, you might find it easier to use C++, since that was the original client's sourcecode language. However, the performance difference is negligible for different languages (especially when you take into account network latency as a speed-limiting factor), so you'll probably want to use the language you're most comfortable with for a trading bot.

Where you might want to consider performance a little more is if you're writing a program to mine Bitcoins. In that instance, you may be able to get a C/C++ program (or even assembly) to perform a little better than an interpreted language.

0

Performance of the language isn't the most important factor in such a chunk of code. Room for error is the biggest I think. C if you are very good at writing C, then do it in C. Python elsewise simply because its harder to write crashing buggy code. Oh and PHP if you want a language that rewards you for writing sloppy code. :P

Also python integrates with C libs fairly easily, so you could always write your efficient pieces in C, then import their functionality in to python.

Not the answer you're looking for? Browse other questions tagged or ask your own question.