1 post in this topic

Auto Sell

I have been teaching my son some things about  BitCoins, HBN, Markets and Coding.   He was looking around Cryptopia and wanted to know what the "API" section meant.  The best way to explain is to show.

 

So we worked on it a bit yesterday and I finished it off last night.  It is a simple script(s) that will watch your balance and then sell based on your wishes.  It can be used with a headless coin that you might mine to and then send as you get coins, or it can be used with S4C on HBN/CAP/HYP whomever is now using it.

 

It uses ruby and shell. So it should work on just about any system. You only need to install MSYS and Ruby on Windows and you are good to go.  Linux and Mac should work with little issue. I have attached the code.

 

To invoke you simply need to have all of the scripts in the same dir and enter

 

 auto_sell.sh COIN TRADE_TYPE

The COIN is just the coin you want to autosell eg HBN. and the TRADE_TYPE is ASK, BID or DUMP.   ASK will put the trade on the top ask price. BID will sell on the bid without looking at how many coins. and DUMP (for now) will just subtract a few sats and try to sell the entire balance right away.

 auto_sell.sh HBN ASK

 

There is only a piece that you might need to fill your self in the ruby code in getbalance.rb . You have to put into an array the COIN to COINID

COINHASH = { "HBN" => 84, "CAP" => 213 }

And you have to enter your API information into getbalance.rb and placetrade.rb

        _API_KEY = "YOUR_API_KEY"
        _API_SECRET = "YOUR_API_SECRET"

I have worked with ruby only this once, so it can be created a lot better with time. I also wanted to show him the difference in languages so I used shell with awk for parsing.  This is simplistic and not fully vetted code, so use at your own risk. But it works pretty well.

 

 

 

auto_sell.sh

coin_info.rb

getbalance.rb

placetrade.rb

Jimmy likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.