Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhemexDataStore で条件付き注文のデータを格納する #210

Merged
merged 1 commit into from Dec 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion pybotters/models/phemex.py
Expand Up @@ -219,10 +219,15 @@ class Orders(DataStore):
def _onmessage(self, data: list[Item]) -> None:
for item in data:
if item["ordStatus"] == "New":
if self.get(item):
self._update([item])
else:
self._insert([item])
elif item["ordStatus"] == "Untriggered":
self._insert([item])
elif item["ordStatus"] == "PartiallyFilled":
self._update([item])
elif item["ordStatus"] == "Filled":
elif item["ordStatus"] in ("Filled", "Deactivated"):
self._delete([item])
elif item["ordStatus"] == "Canceled" and item["action"] != "Replace":
self._delete([item])
Expand Down