https://github.com/byteball/trading-tips
A trading tips library for bonded stablecoins
https://github.com/byteball/trading-tips
Last synced: about 1 year ago
JSON representation
A trading tips library for bonded stablecoins
- Host: GitHub
- URL: https://github.com/byteball/trading-tips
- Owner: byteball
- License: mit
- Created: 2021-01-17T21:43:52.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-22T11:05:26.000Z (over 5 years ago)
- Last Synced: 2025-04-14T14:17:48.111Z (over 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Trading tips library
This library checks for opportunities to make money by buying/selling [Obyte bonded stablecoins](https://ostable.org) when the price of a token is away from the target price.
Use it in your trading bots or for notifications.
## Usage
```js
const tradingTips = require('trading-tips');
// get all tips available now
const all_tips = await tradingTips.getAllTips();
// get tips available on a specific AA only
const all_tips = await tradingTips.getTipsByAA('26XAPPPTTYRIOSYNCUV3NS2H57X5LZLJ');
// be notified about new opportunities that result from new requests that move the price
tradingTips.subscribeToRequests(tips => {
console.log('new tips', tips);
}, 10 * 1000);
// be notified about new opportunities that result from oracle price change
tradingTips.subscribeToOracleUpdates(tips => {
console.log('new tips', tips);
}, 10 * 1000);
// be notified about all new opportunities
tradingTips.subscribe(tips => {
console.log('new tips', tips);
}, 10 * 1000);
```
The `tip` object is a trading recommendation that looks like
```js
{
aa: 'Z7GNZCFDEWFKYOO6OIAZN7GH7DEKDHKA',
action: 'buy',
token_role: 'T1',
token: 'GRB',
reserve_token: 'GBYTE',
current_price: 281.98184269925434,
target_price: 289.44005973691606,
price_difference_percentage: 2.644928115324155,
max_amount: 2.148281867
}
```
Here, `action` is the recommended trade against token `token`, `max_amount` is the amount (in `token`) to buy/sell that would fully restore the peg, `current_price` is the price per token when buying/selling a small amount of `token` (10% of `max_amount`), `target_price` is the price per token after the peg is restored.
The trading recommendations are not financial advice, use at your own risk.