Giter Site home page Giter Site logo

charliecloud / bitcoin-trader Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 51 KB

A Ruby program that allows for BTC price alerts as well as automated/manual buying/selling of BTC based on certain criteria. Uses Coinbase API. User interaction is via email

License: GNU General Public License v3.0

Ruby 100.00%

bitcoin-trader's Introduction

bitcoin-trader

A Ruby program that allows for BTC price updates as well as buying/selling of BTC at current market rates or according to user-defined criteria (at certain prices or at percentages of prices). All interaction is via email. Uses coinbase API for BTC transactions

##Dependencies

Coinbase - gem install coinbase

Ruby-Gmail - gem install ruby-gmail

A gmail account set up for the program to use exclusively is needed. The commands will be sent to his account via email from whatever email account you would likero use.

##Commands

The following commands are currently available. They must be used as specified in the email subject line

  1. price - gets the current BTC price and emails it back to you
  2. alert BTC_PRICE PERCENT- will add an alert to the system so that it will notify you when the price changes by the PERCENT specified (in either direction) from the BTC_PRICE specified
  3. order BUY_OR_SELL ABSOLUTE_OR_PERCENT_OR_MARKET TOTAL_BTC_AMOUNT PRICE_THRESHOLD PERCENT_TRESHOLD NUM_DAYS_ORDER_TO_STAY_ACTIVE NUM_OF_ORDERS_TO_FULFILL BTC_AMOUNT_PER_ORDER - this creates an order for BTC. For the most simple command use only the first 4 params. (ex: order buy market .01)
  4. cancel alert - cancels all of the current price alerts

Download

Download all of the files in the repo to wherever you would like to run them

Run

Create a driver file (can name it whatever) in the same directory as the downloaded files

Create an instance of BitcoinTrader similar to below

//

require_relative 'bitcoin_trader'

btc_trader = BitcoinTrader.new(MIN_CHECK, ABS_MAX, LIVE_ENV, S_KEY,S_SECRET,SBOX_URL,EMAIL,PW, TO_EMAIL)

btc_trader.run

//

Run the file using ruby 'filename'

Here are the explanations for the criteria above

->MIN_CHECK = int, the number of minutes to sleep in between each run of the main loop of the program ->ABS_MAX = float, the absolute max that should be allowed for any BTC transaction the program will run ->LIVE_ENV = boolean, whether to use the live environment or not ->S_KEY = string, the API key to use for Coinbase ->S_SECRET = string, the API secret to use for Coinbase ->SBOX_URL = string, the Sandbox URL to use for Coinbase ->EMAIL = string, the gmail account username (without @gmail.com) that is checked by the program to receive commands ->PW = string, the password for the above account ->TO_EMAIL = the email address that you will be sending commands and receiving updates to

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.