Author Topic: Tradingbots - Infos available?  (Read 3756 times)

0 Members and 1 Guest are viewing this topic.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I just now pushed a new bot I wrote ...

For those that have been familiar with goxtool
(http://prof7bit.github.io/goxtool/) [scary reference to some long forgotten
centralized service] -- that bot should basically do the same as the 'portfolio rebalancing'
strategy of goxtool. (https://bitcointalk.org/index.php?topic=181584.0)
I haven't compared the code though!

Related theory: http://en.wikipedia.org/wiki/Rebalancing_investments#Rebalancing_bonus

Sources: https://github.com/xeroc/btsx_bots/blob/master/bots/market_balance.py

It's "supposed" to keep the wealth split evenly among two assets and trades
when the market moves into either direction ..

Code: [Select]
{
"bot_type": "market_balance",           // bot name (fixed)
"account_name": "balance.bot.account",  // your account name (should be used ONLY by this bot)
"spread_percent": 0.05,                 // trades on prices moves +-5%
"asset_pair": [   
"USD", "BTSX"                   // trades in USD/BTSX in this case (first is quote, second is base)
],
"min_base_balance": 10,                 // minimum BTSX to keep
"min_quote_balance": 10                 // minimum USD to keep
},
The code is supposed to work on any assets as long as the market is open and
the base asset has a lower id on the blockchain

The bot requires an initial equal distribution and would order @ market prices
if this is not the case (asks for manual confirmation of orders for the initial trades)

After that, the bot places orders at +-SPREAD and allocates an amount such that
after the (complete) trade has been filled, both assets hold the "same" wealth.

DISCLAIMER:
- I used this to learn how to write a bot in python
- don't use with serious money unless you know what you are doing and checked the code
- I currently run one bot for USD/BTSX and CNY/BTSX with low volume to check trades

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Sure. I haven't had a chance to work on them since before Vegas so I forget where I was at. You are welcome to redo speculator entirely.
Not sure what it does .. yet :)
Quote
Nathan also worked on this, think he wrote the BTSX class.
Yep .. no shorting yet .. but that may come later :-)
Quote
Anyway he said the lower asset id is considered the base which is enforced by the backend.
Puh .. lucky me BTSX = id 0 ;-)

Offline Riverhead

Sure. I haven't had a chance to work on them since before Vegas so I forget where I was at. You are welcome to redo speculator entirely. Nathan also worked on this, think he wrote the BTSX class. Anyway he said the lower asset id is considered the base which is enforced by the backend.

Sent from my SM-G900T using Tapatalk


Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Yup!
So we started from the same source .. that's worth something :)
As you can see from the network I am currently some commits ahead of others ..


Not sure if toast (I guess he is the owner of the original repo) is willing to merge my changes as I basically removed all his exchange related stuff and replaced it with my own fetching scripts/class ..

Anyway ... I'd be glad if you could take a look into my changesets or the final code .. Later today I might find some time to modify your bot to work with my changes too (shouldn't be too much work)

Offline Riverhead

I've been doing pull requests with the main tool kit release submodule. Might be best if we all work off that?
It's this one: https://github.com/freetradebots/btsx_bots ??
Yup!

Sent from my SM-G900T using Tapatalk


Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I've been doing pull requests with the main tool kit release submodule. Might be best if we all work off that?
It's this one: https://github.com/freetradebots/btsx_bots ??

Offline Riverhead

I've been doing pull requests with the main tool kit release submodule. Might be best if we all work off that?

Sent from my SM-G900T using Tapatalk

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
You are correct. I fix 'em as I find them.
You'd probably spare some time if you rebase/merge with my changes and go over them (IMHO) .. not sure what changes you've done to the code yet that are not pushed to github though ..

Offline Riverhead

You are correct. I fix 'em as I find them.

Sent from my SM-G900T using Tapatalk


Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Hm ... more work to be done for other assets to work properly .. Just figured out that the USD asset is still 'hardcoded' in the BTSX class :(

This is an ongoing thing I'm working on. I've converted most methods to quote and base parameters and created two methods (get_asset_id(self, asset) and get_precision(self, asset) to replace the hard coded USD/BTSX pair where it still exists.
wow .. there where some plenty awkward nameing inconsistencies in the btsx.py .. regarding quote/base ... IMHO  ... base is BTSX and quote is USD ...
am I wrong here?

inconsistency because the bot executes class methods with "(..,. quote, base, ...)" while the function definition was "( ..., base, quote, ...)"

https://github.com/xeroc/btsx_bots/commit/9a371ac425bbbb31b63a70ad1174fcfb6beefecc?diff=split#diff-598f30084986b5878fa6faf86fa2dc97L1

Offline Riverhead

Hm ... more work to be done for other assets to work properly .. Just figured out that the USD asset is still 'hardcoded' in the BTSX class :(

This is an ongoing thing I'm working on. I've converted most methods to quote and base parameters and created two methods (get_asset_id(self, asset) and get_precision(self, asset) to replace the hard coded USD/BTSX pair where it still exists.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Hm ... more work to be done for other assets to work properly .. Just figured out that the USD asset is still 'hardcoded' in the BTSX class :(

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I fear you cant .. the real market machanics are only available on the main net .. i am just trying to say the its your own risk to run that bot .. you can try it with maybe 1000BTSX or so .. thats not "real money" .. if it turns out to work well you might consider increasing ...

I am just not giving any guarantees on anything here

(As doesn't the original bot btw)

Offline cube

  • Hero Member
  • *****
  • Posts: 1404
  • Bit by bit, we will get there!
    • View Profile
  • BitShares: bitcube
I merged my feeds from the delegates pricefeed script with the bot and made some slight further modifications

Sources: https://github.com/xeroc/btsx_bots (USE WITH CAUTION - COMES WITH _A_B_S_O_L_U_T_L_Y_ NO WARRANTY what so ever)

changes:
+ fetches from BTER, BTC38, poloniex, bittrex
+ fetched prices for the other assets from yahoo (except WTI)
+ fetched volumes where possible (the crypto exchanges)
+ bots can now build averages, weighted averaged, median, or any other method based on the data available from all exchanges
+ Object: exchanges .. contains all results from polling and can be used in the bot
+ (almost) no modifications to the market maker bot (except that it has to build an 'average' of some kind from all available prices, and some variable renaming)
+ this bot should (in theory) be able to be market maker for GLD,CNY, and all other assets ... (do not use with 'real' money, unless you checked and rechecked everything)

Have fun ..

Disclaimer: I am currently _not_ yet running it!
Disclaimer 2: I am _not_ a python coder! Expect the worst!

//EDIT: I just merged Nathan's changes into the bot .. now multiple orders/cancels can be executes simultaneously .. at least within one bot ..

Thanks for the wonderful work. I am tempted to try it.

"do not use with 'real' money"

Hmm..  I wonder how to use it with minimal risks while trying it out.  How do I do it without 'real' money?
ID: bitcube
bitcube is a dedicated witness and committe member. Please vote for bitcube.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I merged my feeds from the delegates pricefeed script with the bot and made some slight further modifications

Sources: https://github.com/xeroc/btsx_bots (USE WITH CAUTION - COMES WITH _A_B_S_O_L_U_T_L_Y_ NO WARRANTY what so ever)

changes:
+ fetches from BTER, BTC38, poloniex, bittrex
+ fetched prices for the other assets from yahoo (except WTI)
+ fetched volumes where possible (the crypto exchanges)
+ bots can now build averages, weighted averaged, median, or any other method based on the data available from all exchanges
+ Object: exchanges .. contains all results from polling and can be used in the bot
+ (almost) no modifications to the market maker bot (except that it has to build an 'average' of some kind from all available prices, and some variable renaming)
+ this bot should (in theory) be able to be market maker for GLD,CNY, and all other assets ... (do not use with 'real' money, unless you checked and rechecked everything)

Have fun ..

Disclaimer: I am currently _not_ yet running it!
Disclaimer 2: I am _not_ a python coder! Expect the worst!

//EDIT: I just merged Nathan's changes into the bot .. now multiple orders/cancels can be executes simultaneously .. at least within one bot ..
« Last Edit: October 11, 2014, 07:44:06 pm by xeroc »