Need to specify amount to buy/sell
This commit is contained in:
parent
295caf508c
commit
249f0030dc
@ -4,6 +4,7 @@
|
||||
* [BUY](#buy-statement)
|
||||
* [Functions](#functions)
|
||||
* [PURCHASING_POWER](#purchasing_power)
|
||||
* [CURRENT_PRICE](#current_price)
|
||||
|
||||
|
||||
# Action Statements
|
||||
@ -11,6 +12,7 @@
|
||||
## SELL Statement
|
||||
```
|
||||
[SELL] [Units] OF [Product]
|
||||
FOR [Amount]
|
||||
FROM [Exchange]
|
||||
WITH LIMIT OF [Units]
|
||||
AND
|
||||
@ -34,6 +36,7 @@ SELL 1 SHARES OF QQQ FROM "MyBrokerAccount"
|
||||
#### Sell Trigger
|
||||
```
|
||||
SELL 1 SHARES OF QQQ
|
||||
FOR 10 USD
|
||||
FROM "MyBrokerAccount"
|
||||
WITH LIMIT OF 100 SHARES
|
||||
FOR EVERY
|
||||
@ -45,6 +48,7 @@ AS 'My Hedge Trigger'
|
||||
## BUY Statement
|
||||
```
|
||||
[BUY] [Units] OF [Product]
|
||||
FOR [Amount]
|
||||
FROM [Exchange]
|
||||
WITH LIMIT OF [Units]
|
||||
AND
|
||||
@ -60,6 +64,7 @@ AND
|
||||
### Examples
|
||||
```
|
||||
BUY 1 SHARES OF BTC_ETF
|
||||
FOR 10 USD
|
||||
FROM "MyBrokerAccount"
|
||||
WITH LIMIT OF PURCHASING_POWER( "MyBrokerAccount", "QQQ" )
|
||||
FOR EVERY
|
||||
@ -75,29 +80,73 @@ BUY 1 SHARES OF BTC_ETF
|
||||
|
||||
Returns the maximum [Units] of [Product] can purchase from [Exchange]
|
||||
|
||||
### Other things
|
||||
## CURRENT_PRICE
|
||||
|
||||
`CURRENT_PRICE( Exchange, Product )`
|
||||
|
||||
Returns the current price of a product from exchange
|
||||
|
||||
# Examples
|
||||
|
||||
## Creating a spread
|
||||
|
||||
* Max position: $1000
|
||||
* Spread: $10
|
||||
* QQQ etf price(Qetf): $100
|
||||
|
||||
+-----------------+----------------+
|
||||
| Bid | Ask |
|
||||
+-----------------+----------------|
|
||||
| 10shares@$95 | 10shares@$105 |
|
||||
| ($1000 of Qetf) | ($800 of Qetf) |
|
||||
+-----------------+----------------+
|
||||
|
||||
If a trader hit ur ASK by bidding 2 shares of QQQ token
|
||||
|
||||
+-----------------+----------------+
|
||||
| Bid | Ask |
|
||||
+-----------------+----------------|
|
||||
| 10shares@$95 | 8shares@$105 |
|
||||
| ($1000 of Qetf) | ($800 of Qetf) |
|
||||
+-----------------+----------------+
|
||||
|
||||
If another trader hit ur ASK with a 20 shares of bid, then only 8 shares of his order can be filled.
|
||||
* No need to handle his remaining 12 shares , its not ur responsibility, its his "broker/app/program" to deal with unfilled order.
|
||||
|
||||
+-----------------+----------------+
|
||||
| Bid | Ask |
|
||||
+-----------------+----------------|
|
||||
| 10shares@$95 | |
|
||||
| ($1000 of Qetf) | |
|
||||
+-----------------+----------------+
|
||||
|
||||
|
||||
### SELL Order
|
||||
```
|
||||
(set max position=$1000,
|
||||
spread=$10, QQQ etf price(Qetf)=$100. ),
|
||||
then the quote u give is:
|
||||
Bid Ask
|
||||
10shares@$95 10shares@$105
|
||||
($1000 of Qetf). ($1000 of Qetf)
|
||||
|
||||
if a trader hit ur ASK by bidding 2 shares of QQQ token ,then the output quote:
|
||||
Bid. Ask
|
||||
10shares@$95 8shares@$105
|
||||
($1000 of Qetf). ($800 of Qetf)
|
||||
|
||||
if another trader hit ur ASK with a 20 shares of bid , then only 8 shares of his order can be filled.
|
||||
u dont need to handle his remaining 12 shares , its not ur responsibility, its his "broker/app/program" to deal with unfilled order.
|
||||
so ur quote becomes
|
||||
Bid. Ask
|
||||
10shares@$95
|
||||
($1000 of Qetf).
|
||||
SELL 10 SHARES OF "QQQ_TOKEN"
|
||||
FOR CURRENT_PRICE( "CryptoExchange", "QQQ_TOKEN" ) + 5 USD
|
||||
WITH LIMIT OF 1000 USD
|
||||
FROM "CryptoExchange"
|
||||
```
|
||||
|
||||
|
||||
### BUY Order
|
||||
```
|
||||
BUY 10 SHARES OF "QQQ_TOKEN"
|
||||
FOR CURRENT_PRICE( "CryptoExchange", "QQQ_TOKEN" ) - 5 USD
|
||||
WITH LIMIT OF 1000 USD
|
||||
FROM "CryptoExchange"
|
||||
```
|
||||
|
||||
### BUY Trigger for above
|
||||
```
|
||||
BUY 1 SHARES OF "QQQ"
|
||||
FOR CURRENT_PRICE( "StockExchange", "QQQ" )
|
||||
FROM "StockExchange"
|
||||
FOR EVERY 1 SHARES OF "QQQ_TOKEN" SOLD FROM "CryptoExchange"
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
[In reply to Penguin]
|
||||
#Code example:
|
||||
|
Loading…
Reference in New Issue
Block a user