mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-18 12:20:12 +08:00
ENH: Add a classmethod to TradingAlgorithm to get all API methods.
This commit is contained in:
@@ -881,3 +881,11 @@ class TradingAlgorithm(object):
|
||||
Set a rule specifying that this algorithm cannot take short positions.
|
||||
"""
|
||||
self.register_trading_control(LongOnly())
|
||||
|
||||
@classmethod
|
||||
def all_api_methods(cls):
|
||||
"""
|
||||
Return a list of all the TradingAlgorithm API methods.
|
||||
"""
|
||||
return [fn for fn in cls.__dict__.itervalues()
|
||||
if getattr(fn, 'is_api_method', False)]
|
||||
|
||||
Reference in New Issue
Block a user