Bitcoin Forum
May 21, 2024, 08:10:54 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2] 3 4 5 6 7 8 9 »  All
  Print  
Author Topic: CryptoTrader.org - First Web-based Algorithmic Trading Platform for Bitcoin  (Read 37852 times)
marvinrouge
Sr. Member
****
Offline Offline

Activity: 378
Merit: 250



View Profile
July 15, 2013, 02:40:52 PM
 #21

thanks !  Smiley

Nothing happens when I try to register, is it normal ?
evilscoop
Sr. Member
****
Offline Offline

Activity: 350
Merit: 250



View Profile
July 15, 2013, 02:52:15 PM
 #22

at last.....ive been trying to automate this stuff for months.....
thank you thank you thank you

also cant seem to register....using safari or firefox, both fail
marvinrouge
Sr. Member
****
Offline Offline

Activity: 378
Merit: 250



View Profile
July 16, 2013, 10:11:38 AM
 #23

Is it planned to add other time intervals ? like 2h or 6h
(or let a possibility to custom it)

Sometimes there is a huge difference between 2 consecutive intervals and I would be curious to test the middle Smiley
pulsecat (OP)
Full Member
***
Offline Offline

Activity: 220
Merit: 100



View Profile WWW
July 16, 2013, 05:06:16 PM
Last edit: July 16, 2013, 07:03:58 PM by pulsecat
 #24

thanks !  Smiley

Nothing happens when I try to register, is it normal ?

also cant seem to register....using safari or firefox, both fail

The user related functionality is disabled until basic scripting functionality is ready. Sorry Smiley

Is it planned to add other time intervals ? like 2h or 6h
(or let a possibility to custom it)

Sometimes there is a huge difference between 2 consecutive intervals and I would be curious to test the middle Smiley

Since several people requested for 2H bars i'm going to add such option soon. As regards custom intervals, it shouldn't be hard to implement this, since the backend stores all history data from Mtgox.




CryptoTrader.org - Cloud-based Automated Trading on Bitstamp/BTC-E/CEX.IO/Bitfinex/Kraken | Discussion topic at Bitcointalk.org | Automated Trading Contest (Prize 2 BTC)
pulsecat (OP)
Full Member
***
Offline Offline

Activity: 220
Merit: 100



View Profile WWW
July 16, 2013, 05:13:09 PM
Last edit: July 17, 2013, 06:51:02 PM by pulsecat
 #25

Feature update
- added support for Underscore library (http://underscorejs.org/) - cool utility-belt library for JavaScript that provides support for the usual functional suspects (each, map, reduce, filter...)
- added bindings to Ta-lib library (http://ta-lib.org) - technical analysis library that includes 125+ indicators. Full functions list http://cryptotrader.org/talib

For details check the documentation at the site.

CryptoTrader.org - Cloud-based Automated Trading on Bitstamp/BTC-E/CEX.IO/Bitfinex/Kraken | Discussion topic at Bitcointalk.org | Automated Trading Contest (Prize 2 BTC)
marvinrouge
Sr. Member
****
Offline Offline

Activity: 378
Merit: 250



View Profile
July 16, 2013, 10:51:20 PM
Last edit: July 16, 2013, 11:18:01 PM by marvinrouge
 #26

Since several people requested for 2H bars i'm going to add such option soon. As regards custom intervals, it shouldn't be hard to implement this, since the backend stores all history data from Mtgox.

great  Cheesy

Feature update
- added support for Underscore library (http://underscorejs.org/) - cool utility-belt library for JavaScript that provides support for the usual functional suspects (each, map, reduce, filter...)
- added bindings to Ta-lib library (http://ta-lib.org) - technical analysis library that includes 125+ indicators.

For details check the documentation at the site.

I tried to use the new indicators but even reading the doc in the site it's not much clearer for me

If I just want to access the main value of an indicator with default parameters, what is the code ?

Take ADX as an exemple, is it something like this ?
Code:
instrument = data.btc_usd
indic = instrument.talib.ADX
debug indic.signal
(I know it doesn't work, but I would like to know how far I am)  Grin
Kuroth
Full Member
***
Offline Offline

Activity: 196
Merit: 100



View Profile WWW
July 17, 2013, 12:27:53 AM
 #27

VERY Cool..  Will try this out..

pulsecat (OP)
Full Member
***
Offline Offline

Activity: 220
Merit: 100



View Profile WWW
July 17, 2013, 11:12:06 AM
Last edit: July 17, 2013, 07:21:09 PM by pulsecat
 #28


I tried to use the new indicators but even reading the doc in the site it's not much clearer for me

If I just want to access the main value of an indicator with default parameters, what is the code ?

Take ADX as an exemple, is it something like this ?
Code:
instrument = data.btc_usd
indic = instrument.talib.ADX
debug indic.signal
(I know it doesn't work, but I would like to know how far I am)  Grin

To call TA-Lib function directly, you need to determine the data passed to and from the function.
The function index at http://cryptotrader.org/talib provides information on the arguments and return values.
For example, your algorithm needs to use ADX indicator:
ADX - Average Directional Movement Index

talib.ADX(params)

Input parameters:

- high - array of floats
- low - array of floats
- close - array of floats
- startIdx - start index for input data
- endIdx - end index for input data
- optInTimePeriod

Returns:
 - array of floats

Below is the code that calls ADX function
Code:
    instrument = data.btc_usd
    result = talib.ADX
      high: instrument.high
      low: instrument.low
      close: instrument.close
      startIdx: 0
      endIdx: instrument.close.length-1
      optInTimePeriod: 9
    # result is an array of floats
    debug _.last(result) # Prints current value


CryptoTrader.org - Cloud-based Automated Trading on Bitstamp/BTC-E/CEX.IO/Bitfinex/Kraken | Discussion topic at Bitcointalk.org | Automated Trading Contest (Prize 2 BTC)
ErebusBat
Hero Member
*****
Offline Offline

Activity: 560
Merit: 500

I am the one who knocks


View Profile
July 17, 2013, 02:39:57 PM
 #29

Figured I would post here in case people didn't know, but you can use the Try CoffeeScript tab at http://coffeescript.org/ to get your syntax correct.

Also there is a slight typo in pulsecat's last post, result should not be indented (you can see this at the above website), removing that space and then it compiles.

░▒▓█ Coinroll.it - 1% House Edge Dice Game █▓▒░ • Coinroll Thread • *FREE* 100 BTC Raffle

Signup for CEX.io BitFury exchange and get GHS Instantly!  Don't wait for shipping, mine NOW!
Diabolicus
Member
**
Offline Offline

Activity: 90
Merit: 10


View Profile
July 18, 2013, 09:55:04 AM
 #30


Below is the code that calls ADX function
Code:
    instrument = data.btc_usd
    result = talib.ADX
      high: instrument.high
      low: instrument.low
      close: instrument.close
      startIdx: 0
      endIdx: instrument.close.length-1
      optInTimePeriod: 9
    # result is an array of floats
    debug _.last(result) # Prints current value


When I try this I get
"TypeError: Cannot read property 'high' of undefined"

Could you link some working examples of various indicators maybe? Thanks ..
pulsecat (OP)
Full Member
***
Offline Offline

Activity: 220
Merit: 100



View Profile WWW
July 18, 2013, 10:52:43 AM
 #31

It's true, Coffeescript is very sensitive to formatting.
Here is example of usage ADX indicator

Code:
###
  Example usage of ADX indicator
  The script engine is based on CoffeeScript (http://coffeescript.org)
  Any trading algorithm needs to implement two methods:
    init(context) and handle(context,data)
###  

# Initialization method called before a simulation starts.
# Context object holds script data and will be passed to 'handle' method.
init: (context)->

# This method is called for each tick
handle: (context, data)->
    # data object provides access to the current candle (ex. data['btc_usd'].close)
    instrument = data.btc_usd
    result = talib.ADX
      high: instrument.high
      low: instrument.low
      close: instrument.close
      startIdx: 0
      endIdx: instrument.close.length-1
      optInTimePeriod: 14    
    adx = _.last(result)    
    if adx
        debug "ADX:#{adx} price:#{instrument.price}"    

http://cryptotrader.org/backtests/HQBAMoPXQMtqtskkQ

CryptoTrader.org - Cloud-based Automated Trading on Bitstamp/BTC-E/CEX.IO/Bitfinex/Kraken | Discussion topic at Bitcointalk.org | Automated Trading Contest (Prize 2 BTC)
Diabolicus
Member
**
Offline Offline

Activity: 90
Merit: 10


View Profile
July 19, 2013, 07:32:36 AM
Last edit: July 19, 2013, 08:34:53 AM by Diabolicus
 #32

Thanks pulsecat, that helps a lot!

One more question:
I am trying to add some kind of stop loss to my strategy, therefore I need to somehow store the buy/sell prices for later reference.

Something like:
Quote
if buy_occurs
  buy_price = instrument.price

And then for the following ticks:
Quote
if instrument.price < (buy_price*0.99)
  sell instrument

How exactly would I do that?

Thanks!
pulsecat (OP)
Full Member
***
Offline Offline

Activity: 220
Merit: 100



View Profile WWW
July 19, 2013, 08:17:45 AM
Last edit: July 19, 2013, 08:29:04 AM by pulsecat
 #33

Thanks pulsecat, that helps a lot!

One more question:
I am trying to add some kind of trailing stop loss to my strategy, therefore I need to somehow store the buy/sell prices for later reference.

Something like:
Quote
if buy_occurs
  buy_price = instrument.price

And then for the following ticks:
Quote
if instrument.price < (buy_price*0.99)
  sell instrument

How exactly would I do that?

Thanks!

Use the context object to store variables:
Code:
  if buy_occurs
    context.buy_price = instrument.price

And then
Code:
  if context.buy_price and instrument.price < (context.buy_price*0.99)
    sell instrument

CryptoTrader.org - Cloud-based Automated Trading on Bitstamp/BTC-E/CEX.IO/Bitfinex/Kraken | Discussion topic at Bitcointalk.org | Automated Trading Contest (Prize 2 BTC)
Diabolicus
Member
**
Offline Offline

Activity: 90
Merit: 10


View Profile
July 19, 2013, 08:38:08 AM
 #34

Yes, but how can I make sure the context.buy_price only gets overwritten when a buy actually occurs?
pulsecat (OP)
Full Member
***
Offline Offline

Activity: 220
Merit: 100



View Profile WWW
July 19, 2013, 09:08:20 AM
 #35

That is a good question. When a buy or a sell occurs, the methods return an order id. Otherwise, undefined value is returned.

Code:
  if buy instrument
    context.buy_price = instrument.price

Thanks, i'm going to update documentation with it.

CryptoTrader.org - Cloud-based Automated Trading on Bitstamp/BTC-E/CEX.IO/Bitfinex/Kraken | Discussion topic at Bitcointalk.org | Automated Trading Contest (Prize 2 BTC)
Diabolicus
Member
**
Offline Offline

Activity: 90
Merit: 10


View Profile
July 19, 2013, 09:13:01 AM
Last edit: July 19, 2013, 09:27:40 AM by Diabolicus
 #36

Hmm, that still doesn't seem to work?
pulsecat (OP)
Full Member
***
Offline Offline

Activity: 220
Merit: 100



View Profile WWW
July 19, 2013, 09:38:34 AM
 #37

Please show your code and maybe we can figure out what is wrong.

CryptoTrader.org - Cloud-based Automated Trading on Bitstamp/BTC-E/CEX.IO/Bitfinex/Kraken | Discussion topic at Bitcointalk.org | Automated Trading Contest (Prize 2 BTC)
Diabolicus
Member
**
Offline Offline

Activity: 90
Merit: 10


View Profile
July 19, 2013, 09:48:42 AM
 #38

Quote
init: (context)->
    context.pair = 'btc_usd'
    context.buy_treshold = 0.24
    context.sell_treshold = 0.19
    context.buy_price = 0
    context.previous_price = 0

handle: (context, data)->
    instrument = data[context.pair]
    short = instrument.ema(10) # calculate EMA value using ta-lib function
    long = instrument.ema(21)       
    diff = 100 * (short - long) / ((short + long) / 2)
    if diff > context.buy_treshold
        buy instrument # Spend all amount of cash for BTC
        if buy instrument #<< how do I check if  a buy was executed this tick?
            context.buy_price = instrument.price
            debug "Buy Threshold"
            debug "#{context.previous_price} #{context.buy_price} #{instrument.price}"
    else if diff < -context.sell_treshold
        sell instrument # Sell BTC position
        if sell instrument
            debug "Sell Threshold"
            debug "#{context.previous_price} #{context.buy_price} #{instrument.price}"
    else if instrument.price < (0.985*context.previous_price)
        sell instrument
        if sell instrument
            debug "Trailing Stop Loss"
            debug "#{context.previous_price} #{context.buy_price} #{instrument.price}"
    else if instrument.price < (0.985*context.buy_price)
        sell instrument
        if sell instrument
            debug "Stop Loss"
            debug "#{context.previous_price} #{context.buy_price} #{instrument.price}"
    context.previous_price = instrument.price
Debug should tell for each buy or sell how it was actually triggered. but the 'If buy instrument' condition doesn't work.
http://cryptotrader.org/backtests/f2wBfWCXHvha7N9ip
pulsecat (OP)
Full Member
***
Offline Offline

Activity: 220
Merit: 100



View Profile WWW
July 19, 2013, 10:03:05 AM
 #39

        
Code:
        ...
        buy instrument # Spend all amount of cash for BTC
        if buy instrument #<< how do I check if  a buy was executed this tick?
        ...

As the 'buy' is a function, the above code make it called twice, so that the second call returns undefined value. The right way to do it:
Code:
        ...
        orderId = buy instrument # Spend all amount of cash for BTC
        if orderId
           # a buy was executed
           context.buy_price = instrument.price
           ...

CryptoTrader.org - Cloud-based Automated Trading on Bitstamp/BTC-E/CEX.IO/Bitfinex/Kraken | Discussion topic at Bitcointalk.org | Automated Trading Contest (Prize 2 BTC)
Diabolicus
Member
**
Offline Offline

Activity: 90
Merit: 10


View Profile
July 19, 2013, 10:15:22 AM
Last edit: July 19, 2013, 10:30:42 AM by Diabolicus
 #40

wohoo, works :-)

Here's another one:
Say I would want to output some kind of additional statistics at the end of the simulation (total number of trades, trades triggererd by each mechanism, number of successful / unsuccessful trades etc..) I could add context.counter values for each of these.
Is there a method that gets called at the end of the simulation to finally output these values?
Pages: « 1 [2] 3 4 5 6 7 8 9 »  All
  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!