Skip to content

Instantly share code, notes, and snippets.

@metaperl
Last active June 20, 2020 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metaperl/308c8e76a801c1ff26791316a36ca44a to your computer and use it in GitHub Desktop.
Save metaperl/308c8e76a801c1ff26791316a36ca44a to your computer and use it in GitHub Desktop.
Should type hints and documentation for them be unified?
# https://github.com/metaperl/pymt5adapter/blob/master/pymt5adapter/order.py#L104
def __init__(self,
request: dict = None, *, action: int = None, magic: int = None,
order: int = None, symbol=None, volume: float = None,
price: float = None, stoplimit: float = None, sl: float = None, tp: float = None,
deviation: int = None, type: int = None, type_filling: int = None, type_time: int = None,
expiration: int = None, comment: str = None, position: int = None, position_by: int = None,
**kwargs
):
# BECOMES
def __init__(self,
request: dict = None # a request instance,
*,
action: int = None # the action to take,
magic: int = None # Magic number,
order: int = None # type of order,
symbol=None # symbol to trade,
volume: float = None # number of lots to trade
)
# And it is automatically turned into documentation for Sphinx.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment