diff options
author | terminaldweller <thabogre@gmail.com> | 2021-02-25 08:49:18 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2021-02-25 08:49:18 +0000 |
commit | ff12756915d452e7b92959062ed6315adf0e424e (patch) | |
tree | bb86d9405a8a63d4865594f20a13327920485cf8 /README.md | |
parent | removed the expression parser. using a lib now. the addalert endpoint is work... (diff) | |
download | hived-ff12756915d452e7b92959062ed6315adf0e424e.tar.gz hived-ff12756915d452e7b92959062ed6315adf0e424e.zip |
added a new endpoint for changelly. added somewhat decent logging. cleaned up the code a bit. the secrets are all environment variables now since we want publicly availale CI. the api and postman docs are added. added travis integration.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 47 |
1 files changed, 46 insertions, 1 deletions
@@ -1,2 +1,47 @@ # hived -hived in go +`hived` is the second version of my personal cryptocurrency server.<br/> +hived is currently using redis as its DB because its tiny and fast.<br/> +It sends notifications through telegram.<br/> +Currently it has 4 endpoint:<br/> + +### /price +Lets you ask for the price of the currency. You can determine the currency the value is returned in.<br/> + +### /pair +Takes in a pair of currencies and a multiplier. Determines and returns the ratio.<br/> + +### /addalert +Takes in a name and a math expression containing the names of the currencies. Checks the expression periodically. Sends a message over telegram when the expression holds true.<br/> +The expression's result must be boolean. As an example:<br/> +```Go +ETH*50>50000. +ETH*60/(DOGE*300000) < 4. +``` +You can have as many parameters as you like. The requests for the crypto prices are all turned into individual goroutines so it's fast.<br/> +The expression evaluation is powered by [govaluate](https://github.com/Knetic/govaluate). So for a set of rules and what you can and cannot do please check the documentation over there.<br/> + +### /ex +Gets the list of currencies that are available to be traded.<br/> + +You can check under `./test` for some examples of curl commands.<br/> + +## How to Run +Before you can run this, you need a [telegram bot token](https://core.telegram.org/bots#6-botfather) and a [changelly](https://changelly.com/) API key.<br/> +The keys are put in files and then given to Docker as secrets.The docker entrypoint script then exports these as environment variables.<br/> + +```sh +TELEGRAM_BOT_TOKEN="my-telegram-bot-api-key" +``` +And +```sh +CHANGELLY_API_KEY:"my-changelly-api-key" +``` +And +```sh +CHANGELLY_API_SECRET:"my-changelly-api-secret" +``` +If you want to use docker-compose, it's as simple as running `docker-compose up`. You just need to provide the files. You can check the file names in the docker-compose file.<br/> +Both the server itself and the redis image are alpine-based so they're pretty small.<br/> + +## Docs +You can find the swagger and postman docs under `/api`.<br/> |