Commit Graph

10 Commits

Author SHA1 Message Date
ghubstan
5a78d18103
Refactor createpaymentacct and trade protocol functions
Code duplication needs to be reduced as new scripts are added.

- Refactor the createpaymentacct functions.
  The steps required to create a payment account are still
  displayed, but only for Alice, not Bob.

- Treat the trade protocol simulation as an atomic function.
  This will reduce 'main' simulation script size as new
  ones are added.
2021-01-28 19:33:21 -03:00
ghubstan
30a0f99861
Fix bash syntax inconsistencies
Many unnecesary braces around ${VARIABLE} references were removed.
2021-01-25 12:30:59 -03:00
ghubstan
20e16493aa
Get current mkt price from server, not directly from feed 2021-01-20 15:13:07 -03:00
ghubstan
3244db12c4
Print current market price just before offer is created
This may help confirm offer.price correctness in periods of BTC
price stability.
2021-01-20 13:08:52 -03:00
ghubstan
cb96f27f1c
Remove uneeded ${curlies}
For requested change
https://github.com/bisq-network/bisq/pull/5093#discussion_r560941709
2021-01-20 11:52:29 -03:00
ghubstan
0c06abdc56
Replace shortform '. with longform 'source'
For requested change
https://github.com/bisq-network/bisq/pull/5093#discussion_r560958418
2021-01-20 11:28:42 -03:00
ghubstan
4eabb9804e
Fix indentation
For suggested change
https://github.com/bisq-network/bisq/pull/5093#discussion_r560898873
2021-01-20 10:35:53 -03:00
ghubstan
48a326b990
Add env requirement and usage comments 2021-01-19 15:00:47 -03:00
ghubstan
93c3735f9c
Fix bash bugs & style problems for codacy 2021-01-19 14:38:22 -03:00
ghubstan
873c661218
Add api trade simulation scripts
Two regtest trading simulation scripts are contained in this change:

- trade-simulation.sh goes through the steps of creating F2F payment
  accounts for Bob & Alice, and each step of a trade from createoffer to
  completion.

- limit-order-simulation.sh shows one way to trigger creation of an offer
  when a limit price is reached.

Each script prints CLI commands just before they are run.

Both scripts depend on functions contained in supporting bash and python3
scripts.

Examples:

trade-simulation.sh

  Simulate the entire trade protocol between Bob (taker) & Alice (maker),
  where Alice buys 0.1 BTC from Bob, paying in Renminbi (CYN).

  Note the script takes a country code (CN) not a currency code, so the
  script can create the appropriate country based face to face payment accounts.

  $ apitest/scripts/trade-simulation.sh -d buy -c cn -m 0.0 -a 0.1

limit-order.sh

  Create a CAD/BUY 0.1 BTC order at mkt price margin of 0.0% if price falls to
  or below 47900 CAD.

  Note the script takes a country code (CA) not a currency code, so the script
  can create the appropriate country based face to face  payment accounts.

  $ apitest/scripts/limit-order-simulation.sh -l 47900 -d buy -c CA -m 0.0 -a 0.1

  Create a USD/SELL 0.1 BTC order at mkt price margin of 0.0% if price rises to
  or above 37200 USD.

  $ apitest/scripts/limit-order-simulation.sh -l 37200 -d sell -c US -m 0.0 -a 0.1
2021-01-19 13:46:55 -03:00