fixed some bugs, improved the backtesting and strategy table. Possible now to specify which features we want to use in the backtesting api
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import os
|
||||
from base64 import urlsafe_b64encode
|
||||
|
||||
import boto3
|
||||
import pytest
|
||||
import simplejson as json
|
||||
from freqtrade.aws.backtesting_lambda import backtest, cron
|
||||
@@ -64,15 +66,21 @@ class MyFancyTestStrategy(IStrategy):
|
||||
"body": json.dumps(request)
|
||||
}, {})
|
||||
|
||||
# build sns request
|
||||
request = {
|
||||
"user": "GCU4LW2XXZW3A3FM2XZJTEJHNWHTWDKY2DIJLCZJ5ULVZ4K7LZ7D23TG",
|
||||
"name": "MyFancyTestStrategy",
|
||||
"stake_currency": "usdt",
|
||||
"asset": ["ETH", "BTC", "XRP", "LTC"],
|
||||
"exchange": "binance"
|
||||
"name": "MyFancyTestStrategy"
|
||||
}
|
||||
|
||||
backtest({"body": json.dumps(request)}, {})
|
||||
backtest({
|
||||
"Records": [
|
||||
{
|
||||
"Sns": {
|
||||
"Subject": "backtesting",
|
||||
"Message": json.dumps(request)
|
||||
}
|
||||
}]
|
||||
}, {})
|
||||
|
||||
|
||||
def test_cron(lambda_context):
|
||||
@@ -135,4 +143,7 @@ class MyFancyTestStrategy(IStrategy):
|
||||
}, {})
|
||||
|
||||
print("evaluating cron job")
|
||||
|
||||
cron({}, {})
|
||||
|
||||
#TODO test receiving of message some how
|
||||
|
||||
@@ -628,13 +628,15 @@ def lambda_context():
|
||||
lamb.start()
|
||||
|
||||
session = boto3.session.Session()
|
||||
|
||||
client = session.client('sns')
|
||||
dynamodb = boto3.resource('dynamodb')
|
||||
os.environ["strategyTable"] = "StrategyTable"
|
||||
os.environ["tradeTable"] = "TradeTable"
|
||||
os.environ["topic"] = "UnitTestTopic"
|
||||
|
||||
client = session.client('sns')
|
||||
client.create_topic(Name=os.environ["topic"])
|
||||
|
||||
dynamodb = boto3.resource('dynamodb')
|
||||
|
||||
import responses
|
||||
|
||||
# do not mock requests to these urls
|
||||
|
||||
@@ -490,7 +490,7 @@ def test_processed(default_conf, mocker) -> None:
|
||||
|
||||
def test_backtest_pricecontours(default_conf, fee, mocker) -> None:
|
||||
mocker.patch('freqtrade.optimize.backtesting.exchange.get_fee', fee)
|
||||
tests = [['raise', 17], ['lower', 0], ['sine', 17]]
|
||||
tests = [['raise', 17], ['lower', 0], ['sine', 16]]
|
||||
for [contour, numres] in tests:
|
||||
simple_backtest(default_conf, contour, numres, mocker)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user