adshao / go-binance

A Go SDK for Binance API
MIT License
1.54k stars 677 forks source link

add sub transfer history API #461

Closed ngocthanh1389 closed 1 year ago

ngocthanh1389 commented 1 year ago

What is the problem? Need to add new API to get transfer history

https://binance-docs.github.io/apidocs/spot/en/#transfer-to-master-for-sub-account

adshao commented 1 year ago

chatgpt

adshao commented 1 year ago

Code Review: This pull request adds two new services to the Binance API client: SimpleEarnService and SubTransferHistoryService.

The SimpleEarnService service allows users to query their lending account history for subscription, redemption, and interest.

The SubTransferHistoryService service allows sub-account owners to query their sub-account asset transfer history.

Both services seem to be useful additions that provide more functionality to users of the Binance API client, so the changes seem good.

adshao commented 1 year ago

chatgpt: please tell me if there is any improvement for the code:

${file:v2/simple_earn_service.go}
adshao commented 1 year ago

AI Code Review:

The code seems okay but there is one possible improvement that can be made. The Size method is setting the size parameter to *s.current instead of *s.size. This could be a typo and should be corrected to avoid errors in the future.

The correct implementation should be:

func (s *SimpleEarnService) Size(size int64) *SimpleEarnService {
    s.size = &size
    return s
}

Another suggestion is to add error handling in case the endpoint is not set correctly in the switch statement. This would ensure that the code handles unexpected cases and returns a meaningful error message.

adshao commented 1 year ago

chatgpt: please tell me if there is any improvement in following code:

${file:v2/subaccount_service.go}
adshao commented 1 year ago

AI Code Review:

I cannot determine if there are any bugs in this code as it is only a code snippet and does not include any information about the variables or functions it interacts with.

adshao commented 1 year ago

AI Code Review:

The code looks good, but here are a few minor suggestions:

func (s *SubTransferHistoryService) Do(ctx context.Context) ([]*SubTransfer, error) {

Other than that, the code seems to follow Go's idiomatic style and is well-structured.