Bitcoin Forum
May 06, 2024, 05:00:36 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Building own trading bot  (Read 1096 times)
blankia (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
March 24, 2014, 08:33:42 AM
 #1

Hi,


I got kind of inspired by all the trading bots offered on this site and now I want to build my own bot. Most of the bots that I have seen here are more user friendly, with a nice interface ect. I think the best way to build my own bot is just some plain script that does the trading and nothing more. I just want to do it myself to get to know the inside outs of trading bots and that I am not reliable to someone else for further improvements. I need some pointers in the right direction and am willing to learn some new skills to do this. At the moment it needs to update and search for trading opportunities every 1 to 5 seconds, but maybe in 1 year time this needs to be considerably faster. So im looking to build something that is scalable on speed, as it becomes harder and harder to beat other players.

At the moment I was thinking to write the code in Node js and javascript. How does this sound?
I am collecting trading data in a mysql database and can do the computations for trading opportunities there. The reason for this is, that I think that this method is less prone to errors. For example, exchange sites api lag sometimes and I need to collect data for when a trade is confirmed ect. Is it better?

Are there any other languages that I could best write my code in?

Thanks and help will be appreciated.
1715014836
Hero Member
*
Offline Offline

Posts: 1715014836

View Profile Personal Message (Offline)

Ignore
1715014836
Reply with quote  #2

1715014836
Report to moderator
The trust scores you see are subjective; they will change depending on who you have in your trust list.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715014836
Hero Member
*
Offline Offline

Posts: 1715014836

View Profile Personal Message (Offline)

Ignore
1715014836
Reply with quote  #2

1715014836
Report to moderator
1715014836
Hero Member
*
Offline Offline

Posts: 1715014836

View Profile Personal Message (Offline)

Ignore
1715014836
Reply with quote  #2

1715014836
Report to moderator
00ph8al
Newbie
*
Offline Offline

Activity: 30
Merit: 0


View Profile
March 24, 2014, 09:13:19 AM
 #2

No need to reinvent the wheel. Take an existing bot and modify for your needs. I wasted several months on my own code until I dug deeper into what is out there. My code was usable,but still just the basics. With existing, you get the basics for free and you get to build something advanced more quickly.

For nodejs I run Gekko.   Search for it here or Github.
daybyter
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
March 24, 2014, 11:58:49 AM
 #3

I guess most exchanges will ban you, if you fetch prices every second?

I work on java trading code btw and released a lib to fetch prices from some exchanges btw.

minzie
Member
**
Offline Offline

Activity: 110
Merit: 10



View Profile WWW
March 25, 2014, 04:04:09 PM
 #4

Quote
I guess most exchanges will ban you, if you fetch prices every second?

Bitstamp will ban you if hit their server more than once a second, unless you can convince them to whitelist your IP.

Professional Freelance Web Apps Engineer ° Portfolio °  ModoBot Automated Trading Platform ° BitThingy ° My Github  ° Skype: cclites_1
blankia (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
March 25, 2014, 06:27:46 PM
 #5

No need to reinvent the wheel. Take an existing bot and modify for your needs. I wasted several months on my own code until I dug deeper into what is out there. My code was usable,but still just the basics. With existing, you get the basics for free and you get to build something advanced more quickly.

For nodejs I run Gekko.   Search for it here or Github.


Yess thats a good idea.  Thanks for the pointer, I will take a first look at Gekko.
So I was wondering.. What happens when you see a trading opportunity? Do you place a limit order at one of the open bid-ask prices or do you come in with a market order?  How do you check if the trade was really executed? 
daybyter
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
March 25, 2014, 08:19:31 PM
 #6

Some exchanges have methods to check the status of an order. The most simple way is usually to check your funds. If you bought 1 btc and your btc funds are 1 btc higher than before => order filled.

blankia (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
March 25, 2014, 08:36:54 PM
Last edit: March 25, 2014, 09:01:51 PM by blankia
 #7

Some exchanges have methods to check the status of an order. The most simple way is usually to check your funds. If you bought 1 btc and your btc funds are 1 btc higher than before => order filled.

Like you said, you cant hit the api continuously?, so how to work around this.

For example: You usually check for the opportunity and one round trip (buy USD to BTC and immediately sell BTC to XXX) would look like this:

Make one side of the trade
Wait one sec

Check balance if trade went through
Wait one sec

Make other side of the trade
Wait one sec

Check balance if trade went through
Wait one sec
minzie
Member
**
Offline Offline

Activity: 110
Merit: 10



View Profile WWW
March 25, 2014, 09:12:37 PM
 #8

Something like that.

Professional Freelance Web Apps Engineer ° Portfolio °  ModoBot Automated Trading Platform ° BitThingy ° My Github  ° Skype: cclites_1
blankia (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
March 25, 2014, 09:23:57 PM
 #9

Ok nice.  Do traders sometimes end up with excess inventories/balances :p How big would that risk be? Smiley
daybyter
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
March 25, 2014, 09:24:09 PM
 #10

That might be too slow already. Better hold funds in all the traded currencies and fire all the orders at once.

blankia (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
March 25, 2014, 09:30:38 PM
 #11

One more question Smiley 
What are the rules for hitting an API. So basically if i hit an API for 1 minutes 200 times and then don't do it for 3.5 hours. Averaging once a second. Is that even allowed? Ím just trying to come up with ways to work around it.
daybyter
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
March 25, 2014, 09:42:38 PM
 #12

I guess you are banned then. I wrote some code to fetch prices via proxies, but it's hard to get a list of reliable free proxies.

minzie
Member
**
Offline Offline

Activity: 110
Merit: 10



View Profile WWW
March 25, 2014, 10:12:14 PM
 #13

It is not cumulative... if you hit more than one time a second, you can be banned at any point. Exchanges have to limit traffic or they will get DOSed out of business.

Professional Freelance Web Apps Engineer ° Portfolio °  ModoBot Automated Trading Platform ° BitThingy ° My Github  ° Skype: cclites_1
knightcoin
Full Member
***
Offline Offline

Activity: 238
Merit: 100


Stand on the shoulders of giants


View Profile
March 26, 2014, 06:17:41 AM
 #14

I reading  ...

Professional Automated Trading: Theory and Practice
http://eu.wiley.com/WileyCDA/WileyTitle/productCd-1118129857.html

man ... in LISP ... and some java too ...

http://www.introversion.co.uk/
mit/x11 licence 18.x/16|o|3ffe ::71
olsn
Newbie
*
Offline Offline

Activity: 55
Merit: 0


View Profile
March 26, 2014, 09:09:00 AM
 #15

On Bitstamp you can request more than once a second, just don't exceed 600 per 10minutes -> so averaging 1/s in 10 minutes.
For querying realtime-prices you should use their websocket API: https://www.bitstamp.net/websocket/
daybyter
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
March 26, 2014, 04:35:35 PM
 #16

I reading  ...

Professional Automated Trading: Theory and Practice
http://eu.wiley.com/WileyCDA/WileyTitle/productCd-1118129857.html

man ... in LISP ... and some java too ...

I think that's actually a good combination, although I prefer Scheme these days. I thought about using scheme to implement my own rule-engine, but since drools is available these days, I went the easier route.

csupnig
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile WWW
March 26, 2014, 08:05:23 PM
 #17

Hi there...

I am running a platform where you can code your rule engine in JavaScript then test it and use it for real trading on BTC-e.

There are some strategies already implemented and you can get a hang of how things work pretty fast. You can then use this knowledge to build your own bot Wink

You can find the platform here: http://www.cointelligence.net

Have fun coding your own strategies and rules!
blankia (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
March 28, 2014, 09:53:27 AM
 #18

Hi there...

I am running a platform where you can code your rule engine in JavaScript then test it and use it for real trading on BTC-e.

There are some strategies already implemented and you can get a hang of how things work pretty fast. You can then use this knowledge to build your own bot Wink

You can find the platform here: http://www.cointelligence.net

Have fun coding your own strategies and rules!

Thnx!
blankia (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
March 28, 2014, 10:11:05 AM
 #19

When writing your bot in LISP or Scheme, can you connect to the websockets?
olsn
Newbie
*
Offline Offline

Activity: 55
Merit: 0


View Profile
March 28, 2014, 11:42:10 AM
 #20

There are Websocket-Libraries for LISP, however you would have to write the listener-implementation yourself, I doubt that any exchange would offer that for lisp Wink
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!