Some more edits due to arrow
This commit is contained in:
@@ -11,7 +11,6 @@ from math import floor
|
|||||||
from threading import Lock
|
from threading import Lock
|
||||||
from typing import Any, Coroutine, Dict, List, Literal, Optional, Tuple, Union
|
from typing import Any, Coroutine, Dict, List, Literal, Optional, Tuple, Union
|
||||||
|
|
||||||
import arrow
|
|
||||||
import ccxt
|
import ccxt
|
||||||
import ccxt.async_support as ccxt_async
|
import ccxt.async_support as ccxt_async
|
||||||
from cachetools import TTLCache
|
from cachetools import TTLCache
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from freqtrade.exchange import (ROUND_DOWN, ROUND_UP, amount_to_contract_precisi
|
|||||||
price_to_precision)
|
price_to_precision)
|
||||||
from freqtrade.leverage import interest
|
from freqtrade.leverage import interest
|
||||||
from freqtrade.persistence.base import ModelBase, SessionType
|
from freqtrade.persistence.base import ModelBase, SessionType
|
||||||
from freqtrade.util import FtPrecise
|
from freqtrade.util import FtPrecise, dt_now
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -68,7 +68,7 @@ class Order(ModelBase):
|
|||||||
remaining: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
remaining: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
||||||
cost: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
cost: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
||||||
stop_price: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
stop_price: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
||||||
order_date: Mapped[datetime] = mapped_column(nullable=True, default=datetime.utcnow)
|
order_date: Mapped[datetime] = mapped_column(nullable=True, default=dt_now)
|
||||||
order_filled_date: Mapped[Optional[datetime]] = mapped_column(nullable=True)
|
order_filled_date: Mapped[Optional[datetime]] = mapped_column(nullable=True)
|
||||||
order_update_date: Mapped[Optional[datetime]] = mapped_column(nullable=True)
|
order_update_date: Mapped[Optional[datetime]] = mapped_column(nullable=True)
|
||||||
funding_fee: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
funding_fee: Mapped[Optional[float]] = mapped_column(Float(), nullable=True)
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ from math import isnan
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from typing import Any, Callable, Coroutine, Dict, List, Optional, Union
|
from typing import Any, Callable, Coroutine, Dict, List, Optional, Union
|
||||||
|
|
||||||
import arrow
|
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
from telegram import (CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton,
|
from telegram import (CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton,
|
||||||
ReplyKeyboardMarkup, Update)
|
ReplyKeyboardMarkup, Update)
|
||||||
|
|||||||
+2
-2
@@ -1758,7 +1758,7 @@ def limit_buy_order_canceled_empty(request):
|
|||||||
'id': 'AZNPFF-4AC4N-7MKTAT',
|
'id': 'AZNPFF-4AC4N-7MKTAT',
|
||||||
'clientOrderId': None,
|
'clientOrderId': None,
|
||||||
'timestamp': dt_ts(dt_now() - timedelta(minutes=601)),
|
'timestamp': dt_ts(dt_now() - timedelta(minutes=601)),
|
||||||
'datetime': dt_now() - timedelta(minutes=601).isoformat(),
|
'datetime': (dt_now() - timedelta(minutes=601)).isoformat(),
|
||||||
'lastTradeTimestamp': None,
|
'lastTradeTimestamp': None,
|
||||||
'status': 'canceled',
|
'status': 'canceled',
|
||||||
'symbol': 'LTC/USDT',
|
'symbol': 'LTC/USDT',
|
||||||
@@ -1779,7 +1779,7 @@ def limit_buy_order_canceled_empty(request):
|
|||||||
'id': '1234512345',
|
'id': '1234512345',
|
||||||
'clientOrderId': 'alb1234123',
|
'clientOrderId': 'alb1234123',
|
||||||
'timestamp': dt_ts(dt_now() - timedelta(minutes=601)),
|
'timestamp': dt_ts(dt_now() - timedelta(minutes=601)),
|
||||||
'datetime': dt_now() - timedelta(minutes=601).isoformat(),
|
'datetime': (dt_now() - timedelta(minutes=601)).isoformat(),
|
||||||
'lastTradeTimestamp': None,
|
'lastTradeTimestamp': None,
|
||||||
'symbol': 'LTC/USDT',
|
'symbol': 'LTC/USDT',
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
from datetime import timedelta
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -232,7 +233,7 @@ def mocked_load_data(datadir, pairs=[], timeframe='0m',
|
|||||||
|
|
||||||
NEOBTC = [
|
NEOBTC = [
|
||||||
[
|
[
|
||||||
tests_start_time.shift(minutes=(x * timeframe_in_minute)).int_timestamp * 1000,
|
dt_ts(tests_start_time + timedelta(minutes=(x * timeframe_in_minute))),
|
||||||
math.sin(x * hz) / 1000 + base,
|
math.sin(x * hz) / 1000 + base,
|
||||||
math.sin(x * hz) / 1000 + base + 0.0001,
|
math.sin(x * hz) / 1000 + base + 0.0001,
|
||||||
math.sin(x * hz) / 1000 + base - 0.0001,
|
math.sin(x * hz) / 1000 + base - 0.0001,
|
||||||
@@ -244,7 +245,7 @@ def mocked_load_data(datadir, pairs=[], timeframe='0m',
|
|||||||
base = 0.002
|
base = 0.002
|
||||||
LTCBTC = [
|
LTCBTC = [
|
||||||
[
|
[
|
||||||
tests_start_time.shift(minutes=(x * timeframe_in_minute)).int_timestamp * 1000,
|
dt_ts(tests_start_time + timedelta(minutes=(x * timeframe_in_minute))),
|
||||||
math.sin(x * hz) / 1000 + base,
|
math.sin(x * hz) / 1000 + base,
|
||||||
math.sin(x * hz) / 1000 + base + 0.0001,
|
math.sin(x * hz) / 1000 + base + 0.0001,
|
||||||
math.sin(x * hz) / 1000 + base - 0.0001,
|
math.sin(x * hz) / 1000 + base - 0.0001,
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ def test_dt_utc():
|
|||||||
tzinfo=timezone.utc)
|
tzinfo=timezone.utc)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('as_ms', [True, False])
|
@pytest.mark.parametrize('as_ms', [True, False])
|
||||||
def test_dt_from_ts(as_ms):
|
def test_dt_from_ts(as_ms):
|
||||||
multi = 1000 if as_ms else 1
|
multi = 1000 if as_ms else 1
|
||||||
|
|||||||
Reference in New Issue
Block a user