Okx: fetchLedger unify marginMode
diff --git a/js/okx.js b/js/okx.js
index 8d338c0f96cb..e9c39a4680d8 100644
--- a/js/okx.js
+++ b/js/okx.js
@@ -3118,10 +3118,14 @@ module.exports = class okx extends Exchange {
          * @method
          * @name okx#fetchLedger
          * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
+         * @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days
+         * @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months
+         * @see https://www.okx.com/docs-v5/en/#rest-api-funding-asset-bills-details
          * @param {string|undefined} code unified currency code, default is undefined
          * @param {int|undefined} since timestamp in ms of the earliest ledger entry, default is undefined
          * @param {int|undefined} limit max number of ledger entrys to return, default is undefined
          * @param {object} params extra parameters specific to the okx api endpoint
+         * @param {string|undefined} params.marginMode 'cross' or 'isolated'
          * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/en/latest/manual.html#ledger-structure}
          */
         await this.loadMarkets ();
@@ -3190,6 +3194,16 @@ module.exports = class okx extends Exchange {
             // 'before': 'id', // return records newer than the requested bill id
             // 'limit': 100, // default 100, max 100
         };
+        let marginMode = undefined;
+        [ marginMode, params ] = this.handleMarginModeAndParams ('fetchLedger', params);
+        if (marginMode === undefined) {
+            marginMode = this.safeString (params, 'mgnMode');
+        }
+        if (method !== 'privateGetAssetBills') {
+            if (marginMode !== undefined) {
+                request['mgnMode'] = marginMode;
+            }
+        }
         const [ type, query ] = this.handleMarketTypeAndParams ('fetchLedger', undefined, params);
         if (type !== undefined) {
             request['instType'] = this.convertToInstrumentType (type);

Added marginMode to fetchLedger:

### Cross:
```
node examples/js/cli okx fetchLedger undefined undefined undefined '{"marginMode":"cross"}'

okx.fetchLedger (, , , [object Object])
2022-07-08T06:22:36.364Z iteration 0 passed in 377 ms

                id |     timestamp |                 datetime | account |        referenceId | referenceAccount |  type | currency |   symbol |  amount | before |              after | status |                                      fee
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
464807812252741636 | 1657090818152 | 2022-07-06T07:00:18.152Z |         | 464807812227575826 |                  | trade |     USDT | ETH/USDT |       0 |        |  40.92288696303541 |     ok |             {"cost":0,"currency":"USDT"}
464807812252741635 | 1657090818152 | 2022-07-06T07:00:18.152Z |         | 464807812227575826 |                  | trade |      ETH | ETH/USDT |       0 |        |        0.000908031 |     ok |    {"cost":0.000004583,"currency":"ETH"}
464807894226219048 | 1657090837696 | 2022-07-06T07:00:37.696Z |         |                    |                  | trade |      ETH | ETH/USDT |       0 |        |        0.000908031 |     ok |              {"cost":0,"currency":"ETH"}
...
20 objects
2022-07-08T06:22:36.364Z iteration 1 passed in 377 ms
```

### Isolated:
```
node examples/js/cli okx fetchLedger undefined undefined undefined '{"marginMode":"isolated"}'

okx.fetchLedger (, , , [object Object])
2022-07-08T06:23:25.253Z iteration 0 passed in 367 ms

                id |     timestamp |                 datetime | account |        referenceId | referenceAccount |  type | currency |   symbol |          amount | before |              after | status |                                       fee
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
464803126858657828 | 1657089701067 | 2022-07-06T06:41:41.067Z |         | 464803126829297665 |                  | trade |     USDT | ETH/USDT |               0 |        |  40.89741100923541 |     ok |              {"cost":0,"currency":"USDT"}
464803126858657827 | 1657089701067 | 2022-07-06T06:41:41.067Z |         | 464803126829297665 |                  | trade |      ETH | ETH/USDT |      -0.0001586 |        |         0.00080773 |     ok |         {"cost":7.93e-7,"currency":"ETH"}
464803126862852101 | 1657089701068 | 2022-07-06T06:41:41.068Z |         | 464803126829297665 |                  | trade |     USDT | ETH/USDT |               0 |        |  40.89741100923541 |     ok |              {"cost":0,"currency":"USDT"}
...
40 objects
2022-07-08T06:23:25.253Z iteration 1 passed in 367 ms
```