Code Monkey home page Code Monkey logo

marketmaker-cli's Introduction

MarketMaker Command-Line Interface

License: MIT buildAppVeyor coverage quality gate

This application is a CLI front-end to marketmaker API (barterDEX). It builds a JSON requests based on given arguments and display the results returned by the marketmaker (MM) back-end.

Installation

Installing on OS X

On OS X, and if you have Homebrew already installed, you can install marketmaker-cli in two easy steps:

  1. brew tap eliezio/komodo
  2. brew install marketmaker-cli

Building and installing from sources

On other platforms you'll have to build from sources as explained below.

The build system is based on CMake 3.2+. Follow these steps to build the application:

$ git clone THIS_REPO
$ cd marketmaker-cli
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .
$ make install

Usage

Authentication

To avoid the input of user credentials on every invocation, a pseudo-method named _config shall be used in order to cache this information on a local file ($HOME/.mmcli.config).

Example:

$ ./marketmaker-cli _config http://127.0.0.1:7783 \
1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f

Calling the API

To see the list of available methods and their respective parameters you can use:

$ ./marketmaker-cli -h   # or './marketmaker-cli --help'
Syntax: ./marketmaker-cli [-h | --help | --version | _config URL USERPASS | _refresh | method [-h | --help | params*]

Method                Parameters
====================  =============================================
autoprice ........... base,rel,fixed,minprice,maxprice,margin,refbase,refrel,factor,offset
balance ............. coin,address
balances ............ address
bot_buy ............. base,rel,maxprice,relvolume
bot_list ............
bot_pause ........... botid
bot_sell ............ base,rel,minprice,basevolume
bot_settings ........ botid,newprice,newvolume
bot_status .......... botid
bot_statuslist ......
bot_stop ............ botid
buy ................. base,rel,price,relvolume,timeout,duration,nonce
calcaddress ......... passphrase
disable ............. coin
dividends ........... coin,height
electrum ............ coin,ipaddr,port
enable .............. coin
fundvalue ........... address,holdings,divisor
getcoin ............. coin
getcoins ............
getmyprice .......... base,rel
getpeers ............
getprice ............ base,rel
getprices ...........
getrawtransaction ... coin,txid
goal ................ coin,val
help ................
instantdex_claim ....
instantdex_deposit .. weeks,amount,broadcast
inventory ........... coin,reset,passphrase
jpg ................. srcfile,destfile,power2,password,data,required,ind
lastnonce ...........
listunspent ......... coin,address
myprice ............. base,rel
notarizations ....... coin
notarizations ....... coin
orderbook ........... base,rel,duration
passphrase .......... passphrase,gui,netid,seednode
portfolio ...........
pricearray .......... base,rel,starttime,endtime,timescale
recentswaps ......... limit
secretaddresses ..... prefix,passphrase,num,pubtype,taddr
sell ................ base,rel,price,basevolume,timeout,duration,nonce
sendrawtransaction .. coin,signedtx
setconfirms ......... coin,numconfirms,maxconfirms
setprice ............ base,rel,price,broadcast
snapshot ............ coin,height
snapshot_balance .... coin,height,addresses
statsdisp ........... starttime,endtime,gui,pubkey,base,rel
stop ................
swapstatus .......... base,rel,limit
swapstatus .......... coin,limit
swapstatus .......... pending
swapstatus .......... requestid,quoteid,pending
ticker .............. base,rel
tradesarray ......... base,rel,starttime,endtime,timescale
trust ............... pubkey,trust
withdraw ............ coin,outputs

It's also possible to get help for a specific method by using the special parameter -h or --help. Example:

$ ./marketmaker-cli passphrase -h
Parameters for method 'passphrase': passphrase,gui,netid,seednode

All method parameters are treated as if they were optional. Thus you can suppress one or more ending parameters. See the examples of accepted invocations for the method passphrase:

$ ./marketmaker-cli passphrase testtest beerDEX
$ # or
$ ./marketmaker-cli passphrase testtest beerDEX 0
$ # or
$ ./marketmaker-cli passphrase testtest beerDEX 0 xyz

Unit Tests

The Unit Tests were implemented in C++ using the Google Test Framework (GTF), and their sources are located at $PROJECT_DIR/src/test. The build system automatically downloads and builds the required GTF.

To run the Unit Tests, just run the following command under the build directory:

$ cmake --build . && ./tests

Troubleshooting

In your first run the program automatically fetches and caches the API methods definitions extracted from the output of the 'help' method. In case the marketmaker API changes after this first run, or the cache files becomes corrupted, you can force recreating it using the command:

$ ./marketmaker-cli _refresh

marketmaker-cli's People

Contributors

eliezio avatar

Watchers

 avatar  avatar

marketmaker-cli's Issues

Display clear message when MM daemon is out

A common mistake is to forget to start the MM first.

So, instead of displaying the message:

"***Error while sending/receiving HTTP message: errno=111, msg=Connection refused"

It would be helpful to show "Please make sure marketmaker is running"

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.