Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(phemex) - funding fees #22443

Merged
merged 7 commits into from
May 15, 2024
Merged

fix(phemex) - funding fees #22443

merged 7 commits into from
May 15, 2024

Conversation

ttodua
Copy link
Member

@ttodua ttodua commented May 9, 2024

fix #22434

ts/src/phemex.ts Outdated
@@ -3837,6 +3837,7 @@ export default class phemex extends Exchange {
request['limit'] = limit;
}
let response = undefined;
this.verbose = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ttodua leftover

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh give me a sec :(

@carlosmiei
Copy link
Collaborator

@ttodua something is off here

n phemex fetchFundingHistory "BTC/USD:USD"  --sandbox  
2024-05-09T21:18:08.520Z
Node.js: v18.18.0
CCXT v4.3.18
phemex.fetchFundingHistory (BTC/USD:USD)
2024-05-09T21:18:11.072Z iteration 0 passed in 856 ms

 symbol | code |     timestamp |                 datetime | amount
------------------------------------------------------------------
uBTCUSD |  USD | 1664409600000 | 2022-09-29T00:00:00.000Z |  11452
uBTCUSD |  USD | 1664380800000 | 2022-09-28T16:00:00.000Z |  11695
uBTCUSD |  USD | 1664352000000 | 2022-09-28T08:00:00.000Z |  11270
uBTCUSD |  USD | 1664323200000 | 2022-09-28T00:00:00.000Z |     39
uBTCUSD |  USD | 1664294400000 | 2022-09-27T16:00:00.000Z |     40
uBTCUSD |  USD | 1664265600000 | 2022-09-27T08:00:00.000Z |     41
uBTCUSD |  USD | 1664236800000 | 2022-09-27T00:00:00.000Z |

@ttodua
Copy link
Member Author

ttodua commented May 9, 2024

I'll try to open and retain a position for a day or so, as I didnt have enough timeframe to observe those values in realtime.

-
Merge branch 'phemex-ffh' of github.com:ttodua/ccxt into phemex-ffh

# Conflicts:
#	ts/src/phemex.ts
@ttodua
Copy link
Member Author

ttodua commented May 10, 2024

pushed a fix for USD contracts, now waiting for BTC (Inverse) funding event to confirm that fix also works for inverse markets

@carlosmiei
Copy link
Collaborator

@ttodua any luck?

@ttodua
Copy link
Member Author

ttodua commented May 12, 2024

@ttodua any luck?

I've got unexpected results, so i wrote to phemex support and waiting their response again, will probably have final answer soon

@ttodua
Copy link
Member Author

ttodua commented May 14, 2024

should be ready. tested against BTC/USD:USD, BTC/USDT:USDT, BTC/USD:BTC

@ttodua
Copy link
Member Author

ttodua commented May 15, 2024

@carlosmiei ^

@carlosmiei
Copy link
Collaborator

@carlosmiei ^

@ttodua thanks will merge it shortly

@carlosmiei
Copy link
Collaborator

DEMO

p phemex fetchFundingHistory "BTC/USDT:USDT" --sandbox
Python v3.11.7
CCXT v4.3.18
phemex.fetchFundingHistory(BTC/USDT:USDT)
[{'amount': '0.0642651',
  'code': 'USDT',
  'datetime': '2024-04-25T00:00:00.112Z',
  'id': None,
  'info': {'createTime': '1714003200112',
           'currency': 'USDT',
           'execFeeRv': '0.0642651',
           'execPriceRp': '64265.1',
           'execQtyRq': '0.01',
           'execValueRv': '642.651',
           'feeRateRr': '0.0001',
           'fundingRateRr': '0.0001',
           'side': 'Buy',
           'symbol': 'BTCUSDT'},
  'symbol': 'BTCUSDT',
  'timestamp': 1714003200112},
p phemex fetchFundingHistory "BTC/USD:USD" --sandbox 
Python v3.11.7
CCXT v4.3.18
phemex.fetchFundingHistory(BTC/USD:USD)
[{'amount': '1.1452',
  'code': 'USD',
  'datetime': '2022-09-29T00:00:00.000Z',
  'id': None,
  'info': {'createTime': '1664409600000',
           'currency': 'USD',
           'execFeeEv': '11452',
           'execPriceEp': '194132173',
           'execQty': '2',
           'execValueEv': '388264',
           'feeRateEr': '2949500',
           'fundingRateEr': '2949500',
           'side': 'Buy',
           'symbol': 'uBTCUSD'},
  'symbol': 'uBTCUSD',
  'timestamp': 1664409600000},
 {'amount': '1.1695',
  'code': 'USD',
  'datetime': '2022-09-28T16:00:00.000Z',
  'id': None,

@carlosmiei carlosmiei merged commit cf0e624 into ccxt:master May 15, 2024
2 checks passed
@carlosmiei carlosmiei deleted the phemex-ffh branch May 15, 2024 08:46
kroitor pushed a commit that referenced this pull request May 15, 2024
* fix(phemex) - funding fees

* comments

* remove debug stat

* usd fix

* usdt var

* correction

---------

Co-authored-by: carlosmiei <43336371+carlosmiei@users.noreply.github.com>

[ci skip]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Phemex: fetchFundingHistory -> amount: null
2 participants