Pages:
Author

Topic: Cryptopia trading simulator development (Read 344 times)

newbie
Activity: 28
Merit: 0
January 13, 2019, 09:06:22 AM
#26
Entry post was updated. Updated demo builds of trading bot (t_bot)

core was updated to 1.1.06b
changelog:
- workaround for issue when "GetBalance" request does not work for some c-currencies
- enhanced "scalping2" strategy
newbie
Activity: 28
Merit: 0
January 09, 2019, 04:46:45 PM
#25
Entry post was updated. Added demo build of trading bot (t_bot)

t_sim core was updated to 1.1.04b
changelog:
- refactoring
- added new trading strategy : "scalping2", configured by "scalping2StrategyConfig" struct in config.json (format of strategy settings is pretty similar to "scalping" config )
newbie
Activity: 28
Merit: 0
August 14, 2018, 06:23:15 PM
#24
t_sim and history_collector were updated to 1.0.16b
changelog:
- MacOSX: fixed random crash during trading with several strategies simultaneously
- All platforms: fixed several potential memory leaks
newbie
Activity: 28
Merit: 0
August 07, 2018, 01:43:10 PM
#23
Entry post was updated. MacOSX build of tSim was added. Tested with MacOSX 10.13 (High Sierra)
HistoryCollector's version was changed to 1.0.15b. Both projects uses same codebase so I do not see reasons to keep separate versioning.
newbie
Activity: 28
Merit: 0
August 05, 2018, 04:16:33 PM
#22
Entry post was updated - MacOSX build of History collector 1.0.15b was added. Tested with MacOSX 10.13 (High Sierra)
newbie
Activity: 28
Merit: 0
tSim was updated to 1.0.15b
- now Backtesting mode disabled by default. (You do not need declare ["isBacktester" : false] anymore for realtime simulation)
- couple minor improvements

Entry post was updated. Linux builds of tSim and History collector was added. Compiled with gcc 5.4, tested with Ubuntu 16.04.
newbie
Activity: 28
Merit: 0
tSim was updated to 1.0.14b
changelog:
 - backtesting was optimized.
newbie
Activity: 28
Merit: 0
tSim was updated to 1.0.13b
changelog:
 - added backtesting mode.

To enable backtesting mode you should add this line to main config file:
   "isBacktester" : true,
to specify database file with historycal data you should add:
   "backtestingDataBase" : "cryptopiahistory.sqlite",
Where "cryptopiahistory.sqlite" - name of the SQLite database file. It should be located in the same folder as tSim.
You can create/fill such file with HistoryCollector1.0.1b.
newbie
Activity: 28
Merit: 0
HistoryCollector was updated to 1.0.1b (link and description was moved to entry post)
changelog:
 - Fixed premature program stop
 - Added ability to specify timeframes to store in database. If skipped no candles will be stored
 
 Example:
   "historyCollectorConfig" :
   {
      "timeframes" : [
      {
         "symbol" : "m5"
      },
      {
         "symbol" : "m15"
      },
      {
         "symbol" : "h1"
      }
      ]
   }
   
Supported timeframes: m5, m10, m15, m30, h1, h2, h4, h8, h12, h16, d1, w1

P.S.: tSim + HistoryCollector = seems now I can add support of some kind of backtesting
newbie
Activity: 28
Merit: 0
tSim was updated to 1.0.12b
changelog:
 - fixed premature stop of some strategy due to condition of "allowable losses" if several different strategies run simultaneously
 - now the profit will be shown only after the completion of all strategies.
 
 Work on tSim project is temporary suspended (for several weeks, I believe)
 
 Reason:
 Cryptopia's Public API uses strange and uncommon way to provide historical data. GetMarketHistory method gives list of closed trades (1000 maximum).
 In practice this means about 2 hours of trading history on high loaded market (like BTC_USDT). Thus, there is no possibility to implement some classic trading strategies based on indicators based on analysis of "candlesticks".
 Seems like I have to implement separate service(project) to collect historical data from Cryptopia and build "candle" streams for several timeframes (m5, m10, m15, m30 etc), and keep them in local storage.
 Of course, I could use third-party source of such "candle" history, but in this case we will have to trust one more participant in trading process. I prefer to minimize count of dependencies.

Next update of this thread will relate to new project.
newbie
Activity: 28
Merit: 0
tSim was updated to 1.0.11b
changelog:
 - strategy logging moved to separate log files (scalping.txt, pingpong.txt). [Not sure about it, could be reworked]
 - couple minor bug fixed (logging)
jr. member
Activity: 152
Merit: 4
Bet you won't click the signature link.
Very interesting project.

If you had a simulator module supporting multiple exchanges, then I definitely see the use-cases.

The thing i hate most about making trading bots is the fact that you have to write the logic, and then test that logic thoroughly with real-money trades. I believe it was Binance that had a test_trade call that would validate your params and not execute trade.

Also a very helpful tool for beginners who want to dip their toes i crypto-trading.

I hope you will get plenty support and users for your module Alal! Smiley
newbie
Activity: 28
Merit: 0
tSim was updated to 1.0.10b
changelog:
 - Improved stability (on client side) during API failures (on server side)
newbie
Activity: 28
Merit: 0
tSim was updated to 1.0.9b
changelog:
 - added new trading strategy - "scalping".
 - added settings for new strategy - "scalpingStrategyConfig". format same as "pingpong" settings.
 - now you can use several strategies. They will run simultaneously. (Do we need parameter for serial/parallel running?)
 Example:
      "includeMarkets" : [
   {
      "symbol" : "BTC_USDT",
      "tradingStrategy" : "scalping"
   },
   {
      "symbol" : "ZEC_USDT",
      "tradingStrategy" : "pingpong"
   }
   ]
   Note: logging still goes into one file log.txt, Probably I should split logging by strategies.
   
Due to Cryptopia team's experiments with private API(or issues) last days, I could not check real profitability of "scalping", but simulation shows much better profit than with "pingpong"(or maybe I just got lucky)
newbie
Activity: 28
Merit: 0
tSim was updated to 1.0.8b
changelog:
 - optimized preparation for trading (less http requests)
 - updated format of trading strategy settings : "totalBaseAmountToTrade" and "orderBaseAmount" are lists now.
 Example:
...
   "totalBaseAmountToTrade" : [
   {
      "symbol" : "USDT",
      "amount" : 10
   },
   {
      "symbol" : "BTC",
      "amount" : 0.10
   }
   ],
   
   "orderBaseAmount" : [
   {
      "symbol" : "USDT",
      "amount" : 2
   },
   {
      "symbol" : "BTC",
      "amount" : 0.001
   }
   ],
...
newbie
Activity: 28
Merit: 0
Very good work OP. But: is there any need of simulating trading on cryptopia where the volumes are low and no many trades will trigger?
I choose Cryptopia mostly because I have an Cryptopia's account, so i can compare simulation of autotrading algorithm and autotrading on real account with same algorithm.
Support of new API not so big problem in scale of whole project, i can add another exchange API at any moment(not literally, of course - it can take several days).
All last updates are not directly related to API, they more affect usability and bug fixing. Adding support of another exchange does not make sense since "b" in version mean "beta"

Or are you practicing your coding skills to make something more valuable in the future? Good luck.
Probably, yes. But I do not worry about my coding skills too much, I have enough experience in software development.
sr. member
Activity: 700
Merit: 254
Very good work OP. But: is there any need of simulating trading on cryptopia where the volumes are low and no many trades will trigger?
Or are you practicing your coding skills to make something more valuable in the future? Good luck.
newbie
Activity: 28
Merit: 0
tSim was updated to 1.0.7b
changelog:
 - added exploring status of currency/market before trading start.
 Warning is displayed when currency/market can be delisted/closed.

Example:
http://i65.tinypic.com/2v0k591.jpg
newbie
Activity: 28
Merit: 0
tSim was updated to 1.0.6b
changelog:
- added command line parameter "-s, --sequences" - path to sequences folder (by default: "./sequences")
- added new feature - custom orders sequence processing.

How it works:
You should create .json file with order sequence in it and move it in "/sequences" folder.
Example of custom order sequence is located in /sequences folder in tSim1.0.6b.zip archive:
exampleSequence.json:
{
"orderSequence" : [
   {
      "marketSymbol" : "BTC_USDT", - market symbol
      "type" : "buy",           - type of order ("buy" or "sell")
      "amount" : 40,           - amount of base currency you want to spend
      "price" : 8573.72865433,     - price of trading currency you want to buy
   },
   {
      "marketSymbol" : "BTC_USDT", - market symbol
      "type" : "sell",          - type of order ("buy" or "sell")
      "amount" : 0.00466541,       - amount of trading currency you want to sell
      "price" : 9000          - price of trading currency you want to sell
   }
   ]
}
This sequence means: I'm going to buy "40/8573.72865433 - fee" BTC (= 0.00466541), and then sell 0.00466541 BTC by price 9000 USDT
You can create orders for different markets in one sequence.

After that you should add parameter "runOrderSequence" in main config file and fill it with name(s) of order sequence(s):
Like that:
"runOrderSequence" : [
   {
      "name" : "exampleSequence.json" - name of the order sequence you created in ./sequences folder and want it to run
   },
   {
      "name" : "exampleSequence2.json"
   }
   ],

"runOrderSequence" have higher priority than "includeMarkets".
That means what if "runOrderSequence" is presented in config then "includeMarkets" ignored by tSim - only custom order sequence will be processed.

Example of tSim processing example sequences:
https://i.imgur.com/TnUBzdB

As you can see, tSim simulates filling of each order immediately - no need to wait. Fees is taken into account too.
After each sequence processing resulting balance is shown.

You can use custom order sequence processing feature as profit calculator.
newbie
Activity: 28
Merit: 0
tSim was updated to 1.0.5b
changelog:
- added support for command line parameters.
Currently available parameters: "-h, --help" - params description, "-c, --config" - path to config file
Pages:
Jump to: