Skip to content

Commit f8b7023

Browse files
committed
fixed some minimal bug and allow trades of any timeframe as long as they aregreater or equal to 1
1 parent d31cfba commit f8b7023

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ yarn-error.log*
6060
# ---- OS ----
6161
.DS_Store
6262
Thumbs.db
63-
63+
nul
64+
nul/
6465
# ---- Misc ----
6566
*.egg
6667
.eggs/

crates/binary_options_tools/src/pocketoption/types.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,8 @@ impl Asset {
423423
if !self.is_active {
424424
return Err(PocketError::InvalidAsset("Asset is not active".into()));
425425
}
426-
if 24 * 60 * 60 % time != 0 {
427-
return Err(PocketError::InvalidAsset(
428-
"Time must be a divisor of 86400 (24 hours)".into(),
429-
));
426+
if time == 0 {
427+
return Err(PocketError::InvalidAsset("Time must be a positive value".into()));
430428
}
431429
Ok(())
432430
}

python/BinaryOptionsToolsV2/pocketoption/synchronous.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import threading
44
from datetime import timedelta
55
from typing import Dict, List, Optional, Tuple, Union
6+
import sys
67

78
from ..config import Config
89
from ..validator import Validator
@@ -91,7 +92,7 @@ def __init__(self, ssid: str, url: Optional[str] = None, config: Union[Config, d
9192

9293
def __del__(self):
9394
self._cleanup_loop()
94-
95+
9596
def _cleanup_loop(self):
9697
loop = getattr(self, '_loop', None)
9798
if loop is None or loop.is_closed():
@@ -105,11 +106,20 @@ def _cleanup_loop(self):
105106
future.result(timeout=5)
106107
except Exception:
107108
pass
109+
108110
loop.call_soon_threadsafe(loop.stop)
111+
109112
thread = getattr(self, '_loop_thread', None)
110113
if thread is not None and thread.is_alive():
111-
thread.join(timeout=2)
112-
loop.close()
114+
# During interpreter shutdown, joining threads raises PythonFinalizationError.
115+
# The daemon thread will be killed automatically, so just skip the join.
116+
if not sys.is_finalizing():
117+
thread.join(timeout=2)
118+
119+
try:
120+
loop.close()
121+
except Exception:
122+
pass
113123

114124
@property
115125
def loop(self):

0 commit comments

Comments
 (0)