Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ccxt/ccxt into binanceEditOrderFu…
Browse files Browse the repository at this point in the history
…tures
  • Loading branch information
carlosmiei committed May 19, 2023
2 parents 2c94f10 + 0e9ea14 commit 759ba89
Show file tree
Hide file tree
Showing 66 changed files with 3,641 additions and 1,010 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ before_install:
- php --version
- composer install
script:
- npm run force-build
- npm run test-base
- npm run test-base-ws
- pip list
- ./tests-manager.sh 2>&1
- ./build.sh 2>&1
- git checkout master composer.json
- if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
export SHOULD_DEPLOY=false;
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### 3.1.1 (2023-05-18)

### 3.0.107 (2023-05-18)

### 3.0.106 (2023-05-17)

### 3.0.105 (2023-05-16)

### 3.0.104 (2023-05-15)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ console.log(version, Object.keys(exchanges));

All-in-one browser bundle (dependencies included), served from a CDN of your choice:

* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@3.0.105/dist/ccxt.browser.js
* unpkg: https://unpkg.com/ccxt@3.0.105/dist/ccxt.browser.js
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@3.1.1/dist/ccxt.browser.js
* unpkg: https://unpkg.com/ccxt@3.1.1/dist/ccxt.browser.js

CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.

```HTML
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@3.0.105/dist/ccxt.browser.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@3.1.1/dist/ccxt.browser.js"></script>
```

Creates a global `ccxt` object:
Expand Down
117 changes: 117 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/usr/bin/env bash

if [ "${BASH_VERSION:0:1}" -lt 4 ]; then
echo "EPROGMISMATCH: bash version must be at least 4" >&2
exit 75
fi

if [ $# -gt 0 ]; then
echo "E2BIG: too many arguments" >&2
exit 7
fi

function run_tests {
local rest_args=
local ws_args=
if [ $# -eq 2 ]; then
rest_args="$1"
ws_args="$2"
if [ -z "$rest_args" ]; then
: &
local rest_pid=$!
fi
if [ -z "$ws_args" ]; then
: &
local ws_pid=$!
fi
fi

if [ -z "$rest_pid" ]; then
if [[ -z "$rest_args" ]] || { [[ -n "$rest_args" ]] && [[ $rest_args != "skip" ]]; }; then
# shellcheck disable=SC2086
node test-commonjs.cjs && node run-tests --js --python-async --php-async $rest_args &
local rest_pid=$!
fi
fi
if [ -z "$ws_pid" ]; then
if [[ -z "$ws_args" ]] || { [[ -n "$ws_args" ]] && [[ $ws_args != "skip" ]]; }; then
# shellcheck disable=SC2086
node run-tests-ws --js --python-async --php-async $ws_args &
local ws_pid=$!
fi
fi

if [ -n "$rest_pid" ]; then
wait $rest_pid
fi

if [ -n "$ws_pid" ]; then
wait $ws_pid
fi
}

build_and_test_all () {
npm run force-build
npm run test-base
npm run test-base-ws
run_tests
exit
}

### CHECK IF THIS IS A PR ###
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
echo "not a PR, will build everything"
build_and_test_all
fi

##### DETECT CHANGES #####
diff=$(git diff origin/master --name-only)
diff=$(echo "$diff" | sed -e "s/^build.sh//") # temporarily remove this script from diff

critical_pattern='Client(Trait)?\.php|Exchange\.php|\/test|\/base|^build|static_dependencies|^run-tests|package(-lock)?\.json|ccxt\.ts|__init__.py'
if [[ "$diff" =~ $critical_pattern ]]; then
echo "detected critical change, will build/test everything"
build_and_test_all
fi

echo "detected non-critical change, will build/test specific exchanges"
readarray -t y <<<"$diff"
rest_pattern='ts\/src\/([A-Za-z0-9_-]+).ts' # \w not working for some reason
ws_pattern='ts\/src\/pro\/([A-Za-z0-9_-]+)\.ts'

REST_EXCHANGES=()
WS_EXCHANGES=()
for file in "${y[@]}"; do
if [[ "$file" =~ $rest_pattern ]]; then
modified_exchange="${BASH_REMATCH[1]}"
REST_EXCHANGES+=($modified_exchange)
elif [[ "$file" =~ $ws_pattern ]]; then
modified_exchange="${BASH_REMATCH[1]}"
WS_EXCHANGES+=($modified_exchange)
fi
done

### BUILD SPECIFIC EXCHANGES ###
npm run pre-transpile
echo "REST_EXCHANGES TO BE TRANSPILED: ${REST_EXCHANGES[@]}"
for exchange in "${REST_EXCHANGES[@]}"; do
node build/transpile.js $exchange --force --child
done
echo "WS_EXCHANGES TO BE TRANSPILED: ${WS_EXCHANGES[@]}"
for exchange in "${WS_EXCHANGES[@]}"; do
node build/transpileWS.js $exchange --force --child
done
npm run post-transpile

### RUN SPECIFIC TESTS ###
if [ ${#REST_EXCHANGES[@]} -eq 0 ] && [ ${#WS_EXCHANGES[@]} -eq 0 ]; then
echo "no exchanges to test, exiting"
exit
fi

# rest_args=${REST_EXCHANGES[*]} || "skip"
rest_args=$(IFS=" " ; echo "${REST_EXCHANGES[*]}") || "skip"
# ws_args=${WS_EXCHANGES[*]} || "skip"
ws_args=$(IFS=" " ; echo "${WS_EXCHANGES[*]}") || "skip"

run_tests "$rest_args" "$ws_args"
4 changes: 3 additions & 1 deletion build/transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,10 @@ class Transpiler {
[ /\.isPostOnly\s/g, '.is_post_only'],
[ /\.reduceFeesByCurrency\s/g, '.reduce_fees_by_currency'],
[ /\.omitZero\s/g, '.omit_zero'],
[ /\.currencyStructure\s/g, '.currency_structure'],
[ /\.safeCurrencyStructure\s/g, '.safe_currency_structure'],
[ /\.isTickPrecision\s/g, '.is_tick_precision'],
[ /\.isDecimalPrecision\s/g, '.is_decimal_precision'],
[ /\.isSignificantPrecision\s/g, '.is_significant_precision'],
[ /\ssha(1|256|384|512)([,)])/g, ' \'sha$1\'$2'], // from js imports to this
[ /\s(md5|secp256k1|ed25519|keccak)([,)])/g, ' \'$1\'$2'], // from js imports to this

Expand Down
Loading

0 comments on commit 759ba89

Please sign in to comment.