This is the Coinmetro-CLI, now supercharged and Gemini CLI Powered! Originally a side project by u2ros, this fork has evolved into an intelligent command-line interface for accessing the Coinmetro Crypto Exchange. With deep integration of Gemini AI, it offers advanced natural language processing for intuitive interaction and trading, alongside a robust Postman integration for API documentation. This project is driven by continuous innovation and code enhancements orchestrated by Gemini AI itself, promising a dynamic and intelligent trading experience that pushes the boundaries of AI-assisted command-line interaction.
Coinmetro is a transparent, regulations compliant exchange that should appeal to newbies and pros. Visit coinmetro.com to learn more about the different products they offer.
Please note this is not an official Coinmetro product, it is in early stages, so use at your own risk or use demo mode. The application does not send your credentials to any third party in any way (feel free to examine the source)
Coinmetro CLI is a node.js application, so you need node.js and npm installed to run it.
If you know how to use git just clone the repository, then install it with npm:
cd coinmetro-cli
npm install -g ./
This will install Coinmetro CLI as a global command. You can then use your terminal to input your commands.
Binaries are packaged using the pkg utility.
Generating Binaries for a New Version:
To generate binaries for a new version of the CLI, follow these steps:
- Install
pkg: Ensurepkgis installed as a development dependency (npm install --save-dev pkg) or globally (npm install -g pkg). - Run the build script: Execute the
buildscript defined inpackage.json:This will create platform-specific executables in thenpm run build
distdirectory. - Distribute: Rename the generated executable (e.g.,
cmorcm.exeon Windows) and place it in a directory included in your system'sPATHenvironment variable.
Pre-built Binaries:
You can find pre-built binaries for various platforms under the releases section of the LexGridnev/coinmetro-cli repository.
IMPORTANT: Always use binaries you downloaded from trusted sources. Never use any third-party download links!!!
Coinmetro-CLI will start in demo mode by default. If you want to use it with your actual balance, issue the command below. This is followed by an 'auth login command', which updates your login token and enable you to use trading/balance functions related to your account. If you want to start in demo mode, omit the 'cm auth live' command.
cm auth live // switch to live mode
cm auth login <your email> <your password> // login to update access token (see Command Reference for full details)
Using the cmd module, you can store and chain commands for later use like so:
cm cmd store "cm auth demo && cm auth login myname@blabla.com mypass" demo
cm cmd store "cm auth live && cm auth login myname@blabla.com mypass" live
// Warning: These particular commands will also store your credentials in plain text inside .coinmetro-cli/cmd file inside your home folder, so use with caution!
Or, for example, if you use 2FA, you can use the same command, with an optional parameter (parameters are specified with %p)
cm cmd store "cm auth demo && cm auth login myname@blabla.com mypass %p" demo
cm cmd store "cm auth live && cm auth login myname@blabla.com mypass %p" live
// Warning: These particular commands will also store your credentials in plain text inside .coinmetro-cli/cmd file inside your home folder, so use with caution!
To login to either live or demo mode, you can then use:
cm cmd run demo // this will enable demo mode and log you in as specified in the command definition above
cm cmd run live // this will enable live mode and log you in as specified in the command definition above
Or in case of enabled 2FA:
cm cmd run demo 234235 // this will enable demo mode and log you in as specified in the command definition above
cm cmd run live 568932 // this will enable live mode and log you in as specified in the command definition above
You could create a shorthand to overview a specific market with these commands:
cm cmd store "cm market chart xcmeur d && cm market book xcmeur 10 && cm market trades xcmeur " xcmeur
//then run it anytime using
cm cmd run xcmeur
To place a limit order you can do:
cm trade buy 0.1 btc @10000 eur // buy 0.1 BTC at 10000EUR/BTC for 1000 EUR
Or you can do the inverse operation, result will be the same
cm trade sell 1000 eur @10000 btc // spend 1000 EUR to get 0.1 BTC at 10000EUR/BTC
You can find complete command reference here
The syntax of commands follows this convention:
cm <command> <subcommand> [<args>]
Example:
cm market book btceur
cm trade balance
Some args are optional and may not be needed. Use help option with any subcommand to learn what the defaults are, or check the reference below. If you need help with a specific command you can use:
cm <command> <subcommand> ?
Example:
cm market chart ?
cm trade mbuy ?
Tip: Pairs and currencies are printed in upper case. When inputting, you can use lower case to speed up typing. xcm instead of XCM
Tip: You can have multiple terminal windows opened and use them for issuing different commands
There are two types of errors that can occur:
- server errors which will be the result of semantically incorrect arguments that are denied by the coinmetro servers
- argument errors which will happen when the user inputs invalid, missing or incorrect arguments
An error message will be printed and here are the most common error messages and what to do
- Invalid Token (status: 401): Your access token is no longer valid. Use cm auth login command to update it
- Unauthorized IP (status 422): Happens every once in a while. You need to confirm this device/computer IP (via email) before logging in
The Coinmetro-CLI, now Gemini CLI Powered, is on an exciting path of continuous enhancement. Our roadmap focuses on leveraging AI to deliver a more intelligent and seamless trading experience.
Key Areas of Focus:
- Enhanced Gemini AI Integration:
- Real-time AI Model Integration: Transition from simulated AI responses to actual API calls with a Gemini AI model for
gemini askandtrade nlp. This includes secure API key management and robust error handling for AI service interactions. - Advanced Natural Language Processing (NLP): Improve the
trade nlpcommand's ability to understand complex and varied natural language trade instructions, extracting parameters with higher accuracy and flexibility. - Contextual AI Responses: Implement AI that can maintain context across multiple commands, providing more relevant and personalized assistance.
- Real-time AI Model Integration: Transition from simulated AI responses to actual API calls with a Gemini AI model for
- Postman Integration Expansion:
- Dynamic Collection Generation: Develop the
postman generatecommand to dynamically parse various API documentation formats (e.g., OpenAPI/Swagger) and generate comprehensive Postman collections. - Automated API Testing: Explore integrating Postman's testing capabilities to automate API health checks and validation within the CLI.
- Dynamic Collection Generation: Develop the
- Comprehensive Testing & Code Quality:
- Expanded Unit Test Coverage: Increase unit test coverage for all features, including robust error path testing and edge case handling.
- Integration Tests: Implement integration tests to ensure seamless interaction between different modules and external services.
- Code Refactoring & Optimization: Continuous code cleanup, refactoring, and performance optimization to maintain a high-quality, scalable codebase.
- User Experience & Interactivity:
- Interactive Prompts: Introduce more interactive prompts and user feedback mechanisms for a more intuitive CLI experience.
- Customizable Output: Allow users to customize the output format and level of detail for various commands.
We welcome community contributions, feature requests, and bug reports via GitHub issues to help shape the future of this intelligent trading CLI.
Here is a list of available commands.
- cm ref - Prints out this list
- cm auth demo - activate demo mode
- cm auth live - activate live mode
- cm auth login - login using your credentials
- cm market list - list available markets (pairs)
- cm market chart - draw a market chart
- cm market trades - list recent market trades
- cm market book - display market order book
- cm market ticker - display market ticker
- cm trade balance - list your balances
- cm trade open - list open orders
- cm trade history - list filled orders
- cm trade buy - place a buy order
- cm trade sell - place a sell order
- cm trade mbuy - place a multi buy (iceberg) order
- cm trade msell - place a multi sell (iceberg) order
- cm trade cancel - cancel a single order using order id
- cm trade mcancel - cancel multiple orders using criteria
- cm margin balance - list your balances and update your collateral
- cm margin open - list open orders
- cm margin history - list filled orders
- cm margin buy - place a buy order
- cm margin sell - place a sell order
- cm margin mbuy - place a multi buy (iceberg) order
- cm margin msell - place a multi sell (iceberg) order
- cm margin cancel - cancel a single order using order id
- cm margin mcancel - cancel multiple orders using criteria
- cm cmd list - list all stored commands
- cm cmd store - store a new command
- cm cmd del - delete a stored command
- cm cmd run - run a stored command
- cm gemini login - Login to Gemini.
- cm gemini logout - Logout from Gemini.
- cm gemini ask - Ask a question to the Gemini AI.
- cm trade nlp - Execute a trade using natural language.
- cm gemini-key get - Get a Gemini API key.
- cm bot find-arbitrage - Analyzes all pairs on the exchange for triangular arbitrage opportunities.
- cm bot ma-crossover - Starts a Moving Average Crossover trading bot.
- cm bot stop-bot - Stops a running bot.
- cm postman generate - Generate a Postman collection from the Coinmetro API documentation.
Prints a quick command reference
Syntax:
cm ref
Example:
cm ref
cm ref default
Change to demo mode. After activating the demo mode, you need to update your login token using cm auth login command.
Syntax:
cm auth demo
Example:
cm auth demo
Change to live mode. After activating the live mode, you need to update your login token using cm auth login command.
Syntax:
cm auth live
Example:
cm auth live
Login to exchange to obtain access token. If successful, the command will also indicate which mode (demo|live) you are currently using
Syntax:
cm auth login <username> <password>
username: required, your email address
password: required, your password
Example:
cm auth login whale@gmail.com pumpndump
List available trading pairs (markets)
Syntax:
cm market list
Example:
cm market list
Display a price chart for the specified pair and timeframe
Syntax:
cm market chart <pair> [<timeframe d|w|m|y>]
pair : required
timeframe: chart timeframe, possible values are: d, w (default), m, y
Example:
cm market chart btceur d // display bitcoin market chart for last 24 hours
Display current order book of a specific market
Syntax:
cm market trades <pair> [<date YYYY-MM-HH> <time h:mm:ss>]
pair : required
date : list trades since this date, default 1 day
time : list trades since this time within date, default 0:00:00 (midnight)
Example:
cm market trades btceur // display trades on btceur market within last 24 hours
Display current order book of a specific market
Syntax:
cm market book <pair> [rows>]
pair : required
rows : number of rows to display on buy and sell side, default 10
Example:
cm market book btceur 5 // display bitcoin order book with 5 rows on buy and sell side
Display ticker information for a specific market
Syntax:
cm market ticker <pair>
pair : required
Example:
cm market ticker btceur
List your trade platform balances
Syntax:
cm trade balance
Example:
cm trade balance
Display list of open orders on the trade platform
Syntax:
cm trade open <pair>
pair : required
product : type of open orders to display, 'ex' or 'tram', default ex
Example:
cm order open btceur // display all open orders on btceur market
Display list of filled orders
Syntax:
cm order history [<pair> <since YYYY-MM-DD>]
pair : pair, to filter a specific market
kind : type of open orders to display, 'filled' or 'all', default 'filled'
since : date in format YYYY-MM-DD, default
Example:
cm order history btceur 2020-04-05 // display all filled orders on btceur pair from 2020-04-05 till today
Place a limit buy order. You can also use reverse notation, to precisely specify the amount you want to get out of the trade, rather then how much you input
Syntax:
cm trade buy <buy quantity> <buy currency> @<price> <sell currency> [<time in force: gtc|ioc|gtd|fok> <duration (s)>
buy quantity : required
buy currency : required
price : required specified in format @<price>
sell currency: required,
time in force: time in force, default gtc (good till canceled), can be gtc, ioc, gtd, fok
duration : duration of order in seconds, default 10. applicable if time in force is set to 'gtd'
Example:
cm trade buy 10000 xcm @0.75 eur gtd 10 // buy 10k xcm at 0.75 with euro (xcmeur pair), keep the order for 10 seconds
cm trade buy 1000 eur @8900 btc // sell enough btc at 8900eur/btc to get out 1000 eur precisely
Place a limit sell order. You can also use reverse notation, to precisely specify the amount you want to get out of the trade, rather then how much you input
Syntax:
cm trade sell <sell quantity> <sell currency> @<price> <buy currency> [<time in force: gtc|ioc|gtd|fok> <duration (s)>]
sell quantity : required
sell currency : required
price : required specified in format @<price>
buy currency : required,
time in force : time in force, default gtc (good till canceled), can be gtc, ioc, gtd, fok
duration : duration of order in seconds, default 10. applicable if time in force is set to 'gtd'
Example:
cm trade sell 10000 xcm @0.75 eur gtd 10 // sell 10k xcm at 0.75 for euro (xcmeur pair), keep the order for 10 seconds
cm margin sell 1000 eur @8430 btc // buy exactly 1000 eur worth of btc at 8430
Place a limit multi buy order. Order will be divided into specified number of smaller chunk orders in the specified price range. You can also use reverse notation, to precisely specify the amount you want to get out of the trade, rather then how much you input
Syntax:
cm trade mbuy <buy quantity> <buy currency> @<price range> <sell currency> <order count> [<time in force: gtc|ioc|gtd|fok> <duration (s)>]
buy quantity : required
buy currency : required
price range : required, specified in format @<start price>-<end price>
sell currency: required,
order count : required, specifies into how many chunks to split the order
time in force: time in force, default gtc (good till canceled), can be gtc, ioc, gtd, fok
duration : duration of order in seconds, default 10. applicable if time in force is set to 'gtd'
Example:
cm trade mbuy 10000 xcm @0.01-0.02 eur 10 gtc 10 // buy 10k xcm in range from 0.01 to 0.02 with euro (xcmeur pair), split into 10 chunks, keep the order for 10 seconds
cm trade mbuy 1000 eur @7500-8500 btc 3 // spend 1000 eur to buy btc in 3 orders at 7500, 8000 and 8500
Place a limit multi sell order. Order will be divided into specified number of smaller chunk orders in the specified price range. You can also use reverse notation, to precisely specify the amount you want to get out of the trade, rather then how much you input
Syntax:
cm order msell <sell quantity> <sell currency> @<start price>-<end price> <buy currency> <order count> [<time in force: gtc|ioc|gtd|fok> <duration (s)>]
buy quantity : required
buy currency : required
price range : required, specified in format @<start price>-<end price>
sell currency: required,
order count : required, specifies into how many chunks to split the order
time in force: time in force, default gtc (good till canceled), can be gtc, ioc, gtd, fok
duration : duration of order in seconds, default 10. applicable if time in force is set to 'gtd'
Example:
cm order msell 10000 xcm @0.5-0.6 EUR 10 gtc 10 // sell 10k xcm in range from 0.5 to 0.6 for eur (xcmeur pair), split into 10 chunks, keep the order for 10 seconds
cm order msell 1000 eur @12000-13000 3 // sell 1000 eur worth of btc, layered into orders at 12000, 12500 and 13000
Cancel an order with specific order ID on trade platform
Syntax:
cm trade cancel <order id>
order id : required
Example:
cm trade cancel 5a902cb722a7b962b93234dsfd9b15895286891136ed60b54270a136b
Cancel multiple orders on the trade platform that fit specific criteria
Syntax:
cm trade mcancel <pair> [<mode byprice|bydate> @<start price>-<end price>|<start date YYYY-MM-DD> <start time hh:mm> <end date>YYYY-MM-DD> <end time hh:mm>]
pair : required
mode : optional, 'byprice' or 'bydate'. This governs the use of additional args below
price : required if mode byprice is specified. Price is passed in the format '@<start price><end price>'
start date : required if mode bydate is specified. Format is YYYY-MM-DD
start time : required if mode bydate is specified. Format is hh:mm
end date : required if mode bydate is specified. Format is YYYY-MM-DD
end time : required if mode bydate is specified. Format is hh:mm
Example:
cm trade mcancel xcmeur // cancel all open xcmeur orders
cm trade mcancel xcmeur byprice @0.03-0.04 // cancel all open xcmeur orders between 3 and 4c
cm trade mcancel xcmeur bydate 2020-01-07 7:00 2020-01-09 12:00 // cancel all open xcmeur order placed between specified dates
List your margin platform balances, collateral and exposure or assign collateral.
Warning! If you set collateral to 0 with open positions, you can get a margin call!
Syntax:
cm margin balance [<amount> <currency>]
amount : amount of currency you wish to assign to the platform
currency : currency you are assigning
Example:
cm margin balance // list margin balances
cm margin balance 1200 eur // set eur collateral to 1200
cm margin balance 0 btc // set btc collateral to 0
Display list of open orders on the margin platform
Syntax:
cm margin open <pair>
pair : required
product : type of open orders to display, 'ex' or 'tram', default ex
Example:
cm margin open btceur // display all open orders on btceur market
Display list of filled orders on margin platform
Syntax:
cm order history [<pair> <since YYYY-MM-DD>]
pair : pair, to filter a specific market
kind : type of open orders to display, 'filled' or 'all', default 'filled'
since : date in format YYYY-MM-DD, default
Example:
cm margin history btceur 2020-04-05 // display all filled orders on btceur pair from 2020-04-05 till today
Place a margin limit buy order. You can also use reverse notation, to precisely specify the amount you want to get out of the trade, rather then how much you input
Syntax:
cm margin buy <buy quantity> <buy currency> @<price> <sell currency> [<time in force: gtc|ioc|gtd|fok> <duration (s)>
buy quantity : required
buy currency : required
price : required specified in format @<price>
sell currency: required,
time in force: time in force, default gtc (good till canceled), can be gtc, ioc, gtd, fok
duration : duration of order in seconds, default 10. applicable if time in force is set to 'gtd'
Example:
cm margin buy 10000 xcm @0.75 eur gtd 10 // buy 10k xcm at 0.75 with euro (xcmeur pair), keep the order for 10 seconds
cm margin buy 1000 eur @8900 btc // sell enough btc at 8900eur/btc to get out 1000 eur precisely
Place a margin limit sell order. You can also use reverse notation, to precisely specify the amount you want to get out of the trade, rather then how much you input
Syntax:
cm margin sell <sell quantity> <sell currency> @<price> <buy currency> [<time in force: gtc|ioc|gtd|fok> <duration (s)>]
sell quantity : required
sell currency : required
price : required specified in format @<price>
buy currency : required
time in force : time in force, default gtc (good till canceled), can be gtc, ioc, gtd, fok
duration : duration of order in seconds, default 10. applicable if time in force is set to 'gtd'
Example:
cm margin sell 10000 xcm @0.75 eur gtd 10 // sell 10k xcm at 0.75 for euro (xcmeur pair), keep the order for 10 seconds
cm margin sell 1000 eur @8430 btc // buy exactly 1000 eur worth of btc at 8430
Place a limit multi buy order. Order will be divided into specified number of smaller chunk orders in the specified price range. You can also use reverse notation, to precisely specify the amount you want to get out of the trade, rather then how much you input
Syntax:
cm trade mbuy <buy quantity> <buy currency> @<price range> <sell currency> <order count> [<time in force: gtc|ioc|gtd|fok> <duration (s)>]
buy quantity : required
buy currency : required
price range : required, specified in format @<start price>-<end price>
sell currency: required,
order count : required, specifies into how many chunks to split the order
time in force: time in force, default gtc (good till canceled), can be gtc, ioc, gtd, fok
duration : duration of order in seconds, default 10. applicable if time in force is set to 'gtd'
Example:
cm trade mbuy 10000 xcm @0.01-0.02 eur 10 gtc 10 // buy 10k xcm in range from 0.01 to 0.02 with euro (xcmeur pair), split into 10 chunks, keep the order for 10 seconds
cm trade msell 1000 eur @7500-8500 btc 3 // spend 1000 eur to buy btc in 3 orders at 7500, 8000 and 8500
Place a limit multi sell order. Order will be divided into specified number of smaller chunk orders in the specified price range. You can also use reverse notation, to precisely specify the amount you want to get out of the trade, rather then how much you input
Syntax:
cm order msell <sell quantity> <sell currency> @<start price>-<end price> <buy currency> <order count> [<time in force: gtc|ioc|gtd|fok> <duration (s)>]
buy quantity : required
buy currency : required
price range : required, specified in format @<start price>-<end price>
sell currency: required,
order count : required, specifies into how many chunks to split the order
time in force: time in force, default gtc (good till canceled), can be gtc, ioc, gtd, fok
duration : duration of order in seconds, default 10. applicable if time in force is set to 'gtd'
Example:
cm order msell 10000 xcm @0.5-0.6 EUR 10 gtc 10 // sell 10k xcm in range from 0.5 to 0.6 for eur (xcmeur pair), split into 10 chunks, keep the order for 10 seconds
cm order msell 1000 eur @12000-13000 3 // sell 1000 eur worth of btc, layered into orders at 12000, 12500 and 13000
Cancel an order with specific order ID on trade platform
Syntax:
cm trade cancel <order id>
order id : required
Example:
cm trade cancel 5a902cb722a7b962b93234dsfd9b15895286891136ed60b54270a136b
Cancel multiple orders on the trade platform that fit specific criteria
Syntax:
cm trade mcancel <pair> [<mode byprice|bydate> @<start price>-<end price>|<start date YYYY-MM-DD> <start time hh:mm> <end date>YYYY-MM-DD> <end time hh:mm>]
pair : required
mode : optional, 'byprice' or 'bydate'. This governs the use of additional args below
price : required if mode byprice is specified. Price is passed in the format '@<start price><end price>'
start date : required if mode bydate is specified. Format is YYYY-MM-DD
start time : required if mode bydate is specified. Format is hh:mm
end date : required if mode bydate is specified. Format is YYYY-MM-DD
end time : required if mode bydate is specified. Format is hh:mm
Example:
cm trade mcancel xcmeur // cancel all open xcmeur orders
cm trade mcancel xcmeur byprmarkete @0.03-0.04 // cancel all open xcmeur orders between 3 and 4c
cm trade mcancel xcmeur bydate 2020-01-07 7:00 2020-01-09 12:00 // cancel all open xcmeur order placed between specified dates
Display a list of currently stored commands
Syntax:
cm cmd list
Example:
cm cmd list
Store a command or a chain of commands for later use. Important: Command must be specified inside single or double quotes!
Syntax:
cm cmd store "<command>" <name>
command : required, actual command enclosed in double or single quotes
name : required, shorthand name which will be used for running the command
Example:
cm cmd store "cm auth login whale@gmail.com pumpndump" login // this stores a login command
cm cmd store "cm market chart xcmeur && cm market chart btceur" // this stores a chain of 2 commands (&& is used on Linux to combine multiple commands inline)
Deletes a previously stored command
Syntax:
cm cmd del <name>
name : required, name (shorthand) of command to delete
Example:
cm cmd del mycmd2 // deletes a command called mycmd2
Run a command using its shorthand name
Syntax:
cm cmd run <name>
name : required, shorthand name of the command you want to run
Example:
cm cmd run mylogincmd // this will run a command called mylogincmd which will presumably perform the login
Saves your Gemini API key for future use.
Syntax:
cm gemini login <api_key>
api_key: required, your Gemini API key
Removes your saved Gemini API key.
Syntax:
cm gemini logout
Ask a question to the Gemini AI.
Syntax:
cm gemini ask "<your question>" [--debug]
Arguments:
<your question>: The question you want to ask Gemini.--debug: An optional flag to show the exact prompt being sent to the Gemini service.
Authentication:
This command requires a Gemini API key. You can either set the GEMINI_API_KEY environment variable, or save your API key using the cm gemini login command.
Execute a trade using natural language.
Syntax:
cm trade nlp "<your trade command>"
Examples:
cm trade nlp "buy 100 euro of bitcoin"
cm trade nlp "sell 0.5 btc @ 10000"
The CLI will parse your command and show you the corresponding coinmetro-cli command. You can then copy and paste this command to execute it.
Generate a Postman collection from the Coinmetro API documentation.
Syntax:
cm postman generate
This command will fetch the latest Coinmetro API documentation and save it to a file named coinmetro_api.json in the current directory. You can then import this file into Postman.
Opens the Google AI Studio page to generate a Gemini API key.
Syntax:
cm gemini-key get
Example:
cm gemini-key get
This command will open your default web browser to the Google AI Studio API key generation page. Follow the instructions on that page to create your API key. Once you have your key, set it as an environment variable named GEMINI_API_KEY in your system.
Analyzes all pairs on the exchange for triangular arbitrage opportunities.
Syntax:
cm bot find-arbitrage
This command will fetch the latest prices for all pairs, and then it will analyze all possible triangular paths to find arbitrage opportunities. If any opportunities are found, they will be printed to the console.
Note: This is an experimental feature. Arbitrage opportunities are rare and fleeting. This tool is for analysis purposes only and does not execute any trades.
Starts a Moving Average Crossover trading bot. The bot continuously monitors the price of a specified pair, calculates short and long moving averages, and executes buy/sell orders based on crossovers.
Syntax:
cm bot ma-crossover <pair> <amount> <short> <long> <timeframe>
pair : required, the trading pair (e.g., BTCEUR)
amount : required, the amount of base currency to trade
short : required, period for the short moving average
long : required, period for the long moving average
timeframe : required, timeframe for candles in milliseconds (e.g., 3600000 for 1 hour)
Note: This bot runs as a detached process. You can stop it using cm bot stop-bot. This is an experimental feature and should be used with caution.
Stops a running Moving Average Crossover trading bot.
Syntax:
cm bot stop-bot
This command will stop the bot process that was started using cm bot ma-crossover.


