Skip to content

Incorrect Type in futures/market.py #413

@will-j-c

Description

@will-j-c

Describe the bug
Not a bug per se as the library runs but "resolution" in the method get_ohlc() of Market has the wrong type declared ("int" instead of "str") causing false error detection in IDEs.

To Reproduce
Steps to reproduce the behavior:

Open a new file

from kraken.futures import Market

if __name__ == '__main__':
    x = Market().get_ohlc(tick_type="trade", symbol="PI_XBTUSD", resolution="1h")
    print(x)

For example, in Vs Code, the resolution parameter will cause the below error:

Argument of type "Literal['1h']" cannot be assigned to parameter "resolution" of type "int" in function "get_ohlc"
"Literal['1h']" is not assignable to "int"PylancereportArgumentType

Expected behavior
A string is the correct input so the error should not appear.

Additional context
This is a very quick fix, simply changing the type to "str" on line 86 of market.py.

I'm happy to do so in a PR and do some additional spot checks but wanted to raise the issue first given its a small issue.

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions