You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
923 B
33 lines
923 B
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
from .risk_manager_base import RiskManagerBase
|
|
|
|
|
|
class PassThroughRiskManager(RiskManagerBase):
|
|
def __init__(self):
|
|
self._orderperseconds = 0
|
|
self._queryperseconds = 0
|
|
|
|
def reset(self):
|
|
self._orderperseconds = 0
|
|
self._queryperseconds = 0
|
|
|
|
def order_in_compliance(self, original_order):
|
|
"""
|
|
Pass through the order without constraints
|
|
"""
|
|
return original_order
|
|
|
|
def passorder(self):
|
|
self._orderperseconds = self._orderperseconds + 1
|
|
if (self._orderperseconds > 4):
|
|
print('order flow rate limit reached ')
|
|
return False
|
|
return True
|
|
|
|
def passquery(self):
|
|
self._queryperseconds = self._queryperseconds + 1
|
|
if (self._queryperseconds > 1):
|
|
print('query flow rate limit reached ')
|
|
return False
|
|
return True
|
|
|