Commit Graph

51 Commits

Author SHA1 Message Date
ghubstan
a9aaba87fa
Rename API method keepfunds -> closetrade
Trade proceeds and deposits have already been transfered to Bisq wallets
before the `keepfunds` command is (was) executed;  `keepfunds` merely moves
open trades to closed trades lists and persistence files.  Renaming `keepfunds`
as `closetrade` makes its purpose clear to API users.

The commit modifies only method names and comments in api server+cli classes,
apitest cases, and api trade simulation scripts.

Based on `master`
2022-01-05 12:10:46 -03:00
ghubstan
5f571cccca
Deprecate API 'getmyoffer'
The method 'getoffer' should support looking up a user's open-offers, and other users' available offers.

- Adjust api-beta-test-guide.md to use only 'getoffer'.
- Adjust trade simulation scripts to use only 'getoffer'.
- Adjust api testcases to use 'getoffer' in place of 'getmyoffer'.
- Mark appropriate methods and protobuf msgs as deprecated.
2021-12-27 12:05:17 -03:00
ghubstan
f867f6beb3
Add new regtest apitest/scripts/trade-xmr-simulation.sh 2021-12-02 19:18:24 -03:00
ghubstan
a1db0d10b0
Update API docs for Bitcoin Core version v22.0
Plus some outdated JDK version compat comments.
2021-11-29 12:43:58 -03:00
ghubstan
8b2dec7a55
Remove unused function outputs 2021-11-28 16:37:41 -03:00
ghubstan
1b7e43a874
Add apitest/scripts/bsqswap-simulation.sh script
Some refactoring and typo corrections in existing scripts too.
2021-11-28 16:12:02 -03:00
chimp1984
72284d7d9f
Cleanups, refromatting, add final qualifier 2021-10-20 00:11:36 +02:00
ghubstan
bfff30bcdd
Call 'keepfunds' (close trade) on both sides of trade simulation 2021-09-20 12:09:38 -03:00
ghubstan
cff5e8163e
Update apitest docs for bitcoin-core v0.21 compat
The test harness is compatible with bitcoin-core 0.19, 0.20, 0.21.

Also removed some unnecessary comments about registering dispute
agents in the test harness because it now happens by default.
2021-04-19 12:35:13 -03:00
ghubstan
152f4591eb
Remove unused parameter 2021-03-26 11:04:51 -03:00
ghubstan
780be1a93c
Adjust maker gettrade output checks to new column
The number of gettrade output columns are the same for makers and takers.
2021-03-26 10:58:47 -03:00
ghubstan
19aed84910
Fix getunusedbsqaddress test 2021-02-27 22:58:22 -03:00
ghubstan
b618776b1b
Wait 3 secs after removing password (for wallet save) 2021-02-27 22:50:14 -03:00
ghubstan
3bbefffb9c
Adjust mainnet bats test to default rate meter interceptors 2021-02-27 22:38:38 -03:00
ghubstan
d60c0dd3ca
Display buyer's cost in api's gettrade output
The offer volume is shown so traders know how much fiat
they are sending or receiving without having to call getoffer.

Changed the 'Fiat Sent' and 'Fiat Received' column headers
to show which fiat is being transfered, e.g., 'EUR Sent',
'EUR Received'.

Adjusted apitest's trade-simulation-utils.sh to the modified
gettrade output.
2021-02-26 15:25:31 -03:00
ghubstan
bcf1b3b836
Fix find pid on OSX
The trade simulation scripts check that bitcoind, seed node,
arbitration node, and bob & alice nodes are running at startup,
but the bash pgrep command used to find the PIDs does not work on
OSX (my darwin20), so an adjustment was made to the env script to
find java PIDs with ps and awk if running on OSX.

Two additonal startup checks were added: make sure the script is
running on supported OS (Linux or OSX), and bitcoin-cli is in
the PATH.

Also removed usage error text about registering dispute agents.
The scripts do that now.
2021-02-04 19:16:19 -03:00
ghubstan
072364b490
Explain 'payment sent' implies 'funds deposited'
There is no need to simulate the time it takes between
receiving a 'payment sent' msg and having funds (fiat) deposited
in the seller's bank account.  But there is need to explain
that in the script.
2021-02-03 12:11:33 -03:00
ghubstan
99af81d51d
Remove DONE flag
There should not be a check on that flag in the rolling offers script.
Terminate the script with ^C.
2021-01-29 18:13:34 -03:00
ghubstan
e3f707fea6
Make executetrade simulation more realistic
Demonstrate how traders poll trade status as they go through
the protocol.
2021-01-29 18:04:02 -03:00
ghubstan
da5e1e5ade
Add functions for checking trade status 2021-01-29 13:53:23 -03:00
ghubstan
d580e77bf8
Try alternative syntax to make codacy happy
The codacy issue "$/${} is unnecessary on arithmetic variables"
seems to not apply to $(echo $((1 + $RANDOM % 10))), but we
try another syntax to make her happy.
2021-01-29 11:47:37 -03:00
ghubstan
27a4a31dcc
Add apitest rolling offer simulation script
The script demonstrats a way to always keep one offer in the market.
As soon as the offer is taken and the trade is completed, another
offer is placed.
2021-01-28 20:11:09 -03:00
ghubstan
74008e9385
Move createoffer command generation to its own function 2021-01-28 19:56:15 -03:00
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
184ffd14db
Enclose $vars in double quotes 2021-01-20 15:26:36 -03:00
ghubstan
78d0024368
Re-add exports to make codacy happy 2021-01-20 15:25:22 -03:00
ghubstan
7fa61c9a32
Remove deprecated python script 2021-01-20 15:14:20 -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
8b4938a9eb
Do not export vars from lowest level child script
For requested change
https://github.com/bisq-network/bisq/pull/5093#discussion_r560932201
2021-01-20 11:36:01 -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
6c322d4aae
Put $N variable references in double quotes
For requested change
https://github.com/bisq-network/bisq/pull/5093#discussion_r560938698
2021-01-20 11:20:30 -03:00
ghubstan
73c6b3d96b
Fix typo, group mutually exclusive opts around '||' 2021-01-20 11:16:54 -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
cf419d2d58
Make price request frequency configurable
Added a -w option to  allow user to control the frequency of price requests.
The minimum value = 20s, default value = 120s.
2021-01-19 16:13:21 -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
ghubstan
49a3b46960
Add CoreHelpService gRPC stubs and test case 2021-01-14 10:22:14 -03:00
ghubstan
daeb34b3d2
Add two new api method tests
Keeping the bats test simple.  More complex use cases are tested in
apitest, and we don't want to be trading on mainnet with a bats test.

- Add new getunusedbsqaddress test, assert success return status.
- Add new getpaymentmethods test, assert success return status.
2020-11-22 16:25:21 -03:00
ghubstan
424f9480ad
Fix broken tests
- Change the getbalance tests to just check a sucessful '0' status code.

  The api's getbalance method returns full balance info now, not just a
  formatted long.  We still assert the cmd did not fail, but don't check
  the value string.

- Remove obsolete createpaymentacct tests.

  This is well tested in apitest, and testing this cmd is unnecesarily
  complex to do in a bats script.
2020-11-22 16:12:34 -03:00
ghubstan
6f159bcb48
Fix usage comment 2020-11-02 12:55:18 -03:00
ghubstan
34cfe9532f
Remove comment 2020-09-22 14:51:31 -03:00
ghubstan
9132722bbf
Replace hardcoded version with Version.java value
Bats version check tests now use a bash script for parsing
the value from the Bisq class file, and these test cases
no longer need to be manually updated.
2020-09-22 14:45:21 -03:00
ghubstan
e2bd89f39a
Refactor API & add registerdisputeagent method to CLI
This commit contains most of the changes suggested by @chimp1984 in
his api-suggestions branch.  See
961703ecea

A new 'registerdisputeagent' method was also added to MainCli, finishing
the work to support registration of mediators and refund agents on
arbitration daemons running in regtest mode.  This method cannot be
used to register dispute agents on mainnet;  users will see an error
msg if they try.
2020-09-18 11:33:16 -03:00
ghubstan
3f0394f722
Bump version to 1.3.8 2020-09-14 12:14:37 -03:00
ghubstan
2c803ef811
Move :cli test.sh to :apitest mainnet-test.sh
* The bats test script was moved to the apitest subproject and renamed.

* Version tests were updated for release 1.3.7.

* The duplicated "test getoffers buy eur check return status" was
  replaced by a new "test getoffers sell eur check return status" test.

* The bats dependency was switched to bats-core because development
  has halted on https://github.com/sstephenson/bats/tree/master.
  The new bats repository is
          https://github.com/bats-core/bats-core/tree/master
2020-08-25 11:42:09 -03:00
ghubstan
45c1a97938
Fix codacy problem in bash script
Double quote to prevent globbing and word splitting.
2020-07-14 12:21:13 -03:00