Either I am unable to figure out how to use -Before and -After (I think they make use of the Coinbase Pro API Pagination at https://docs.pro.coinbase.com/#pagination), or it's not working properly.
Objective:
Retrieve all of my Fills. The quantity of fills exceeds the default -Limit 100.
Testing -Before:
Here's a test. I'm attempting to retrieve the five most recent BTC-USD fills, then the next 5, then the next 5. The result should be the 15 most recent BTC-USD fills.
# Get the five most recent BTC-USD fills (1-5)
Get-CoinbaseProFills -APIKey $APIKeyViewOnly -APISecret $APISecretViewOnly -APIPhrase $APIPhraseViewOnly -ProductID BTC-USD -Limit 5 | Format-Table created_at, trade_id -AutoSize
created_at trade_id
---------- --------
2020-01-23T12:00:42.78Z 81616182
2020-01-23T02:10:28.494Z 81597680
2020-01-21T19:41:42.511Z 81540634
2020-01-19T11:03:26.573Z 81433806
2020-01-19T11:01:54.112Z 81431376
# Get the next 5 most recent BTC-USD fills (6-10)
Get-CoinbaseProFills -APIKey $APIKeyViewOnly -APISecret $APISecretViewOnly -APIPhrase $APIPhraseViewOnly -ProductID BTC-USD -Limit 5 -Before 1 | Format-Table created_at, trade_id -AutoSize
created_at trade_id
---------- --------
2017-08-02T13:37:08.414Z 18838454
2017-07-30T05:45:22.854Z 18731934
2017-07-30T05:38:29.166Z 18730012
2017-07-26T06:45:26.241Z 18618952
2017-07-25T19:01:58.041Z 18598131
# Get the next 5 most recent BTC-USD fills (11-15)
Get-CoinbaseProFills -APIKey $APIKeyViewOnly -APISecret $APISecretViewOnly -APIPhrase $APIPhraseViewOnly -ProductID BTC-USD -Limit 5 -Before 2 | Format-Table created_at, trade_id -AutoSize
created_at trade_id
---------- --------
2017-08-02T13:37:08.414Z 18838454
2017-07-30T05:45:22.854Z 18731934
2017-07-30T05:38:29.166Z 18730012
2017-07-26T06:45:26.241Z 18618952
2017-07-25T19:01:58.041Z 18598131
Unexpected Results:
The results above are not what I expected.
For the Get-CoinbaseProFills, -Before is not used. The five most recent Fills are retrieved (fills 1 to 5) that occurred in 2020. This works as expected.
For the next Get-CoinbaseProFills, I add -Before 1. My expectation is that the function retrieves the next five fills (fills 6 to 10). Instead, the function retrieves the first 5 fills I ever made on Coinbase in 2017.
For my third Get-CooinbaseProFills test, I add -Before 2. Now my expectation is that the function would retrieve the five fills that I made in 2017. If so, then I could retrieve all of my fills by working backwards. Instead, the function again retrieves the first 5 fills I ever made on Coinbase in 2017.
Is Pagination working correctly and I'm just not smart enough to figure it out?
I've tried several other test usages of -Before and -After. Either pagination is not working correctly, or I'm unable to figure out how to properly use these pagination options.
At best, I'm able to retrieve my 100 most recent fills and my first 100 fills for a total of 200 unique fills. If pagination isn't broken, would you kindly provide me an example of how to retrieve the fills in the middle (before and after the first and last 100 fills)?
Thank you.
Either I am unable to figure out how to use -Before and -After (I think they make use of the Coinbase Pro API Pagination at https://docs.pro.coinbase.com/#pagination), or it's not working properly.
Objective:
Retrieve all of my Fills. The quantity of fills exceeds the default -Limit 100.
Testing -Before:
Here's a test. I'm attempting to retrieve the five most recent BTC-USD fills, then the next 5, then the next 5. The result should be the 15 most recent BTC-USD fills.
Unexpected Results:
The results above are not what I expected.
For the Get-CoinbaseProFills, -Before is not used. The five most recent Fills are retrieved (fills 1 to 5) that occurred in 2020. This works as expected.
For the next Get-CoinbaseProFills, I add -Before 1. My expectation is that the function retrieves the next five fills (fills 6 to 10). Instead, the function retrieves the first 5 fills I ever made on Coinbase in 2017.
For my third Get-CooinbaseProFills test, I add -Before 2. Now my expectation is that the function would retrieve the five fills that I made in 2017. If so, then I could retrieve all of my fills by working backwards. Instead, the function again retrieves the first 5 fills I ever made on Coinbase in 2017.
Is Pagination working correctly and I'm just not smart enough to figure it out?
I've tried several other test usages of -Before and -After. Either pagination is not working correctly, or I'm unable to figure out how to properly use these pagination options.
At best, I'm able to retrieve my 100 most recent fills and my first 100 fills for a total of 200 unique fills. If pagination isn't broken, would you kindly provide me an example of how to retrieve the fills in the middle (before and after the first and last 100 fills)?
Thank you.