Merge remote-tracking branch 'Mariam/develop' into develop

This commit is contained in:
Luis Fernando Molina committed 2020-11-20 18:58:42 +01:00
commit 57f085942a
11 files changed
+588

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
+11
View File
@@ -0,0 +1,11 @@
.vs/*
obj/*
bin/*
*.config
*.log
*.cache
node_modules/*
+25
View File
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "Project", "Project.njsproj", "{AA2901BC-8F81-40F0-A402-5CA79A3F22AD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AA2901BC-8F81-40F0-A402-5CA79A3F22AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA2901BC-8F81-40F0-A402-5CA79A3F22AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA2901BC-8F81-40F0-A402-5CA79A3F22AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA2901BC-8F81-40F0-A402-5CA79A3F22AD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B4BDAEAF-E863-458A-87C1-CC6D8C490784}
EndGlobalSection
EndGlobal
+18
View File
@@ -0,0 +1,18 @@
exports.newCommons = function newCommons(bot, logger, UTILITIES) {
const FULL_LOG = true;
const LOG_FILE_CONTENT = false;
const MODULE_NAME = "Commons";
let thisObject = {
initialize: initialize
};
return thisObject;
function initialize() {
}
};
+24
View File
@@ -0,0 +1,24 @@
Financial Beings License
Collective Copyright by the Advanced Algos Community
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software including without limitation the rights to use, copy, modify,
merge, publish, distribute and sublicense copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following
conditions:
1. Using, copying, modifying, publishing, distributing and sublicensing rights
are restricted to the Advanced Algos Platform, meaning the rights granted can
only be exercised through the Advanced Algos Service.
2. The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

+78
View File
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{aa2901bc-8f81-40f0-a402-5ca79a3f22ad}</ProjectGuid>
<ProjectHome />
<ProjectView>ShowAllFiles</ProjectView>
<StartupFile>User.Bot.js</StartupFile>
<WorkingDirectory>
</WorkingDirectory>
<OutputPath>.</OutputPath>
<ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<Name>Project</Name>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'" />
<PropertyGroup Condition="'$(Configuration)' == 'Release'" />
<ItemGroup>
<Content Include="obj\Debug\AABruce.njsproj.FileListAbsolute.txt" />
<Content Include="obj\Debug\AACarol.njsproj.FileListAbsolute.txt" />
<Content Include="obj\Debug\AACharly.njsproj.FileListAbsolute.txt" />
<Content Include="this.bot.config.json" />
</ItemGroup>
<ItemGroup>
<Folder Include="bin" />
<Folder Include="Trading-Process\" />
<Folder Include="obj" />
<Folder Include="obj\Debug" />
</ItemGroup>
<ItemGroup>
<Compile Include="Commons.js" />
<Compile Include="Trading-Process\User.Bot.js" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<!--Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them.-->
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
<Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:48022/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>True</UseCustomServer>
<CustomServerUrl>http://localhost:1337</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}" User="">
<WebProjectProperties>
<StartPageUrl>
</StartPageUrl>
<StartAction>CurrentPage</StartAction>
<AspNetDebugging>True</AspNetDebugging>
<SilverlightDebugging>False</SilverlightDebugging>
<NativeDebugging>False</NativeDebugging>
<SQLDebugging>False</SQLDebugging>
<ExternalProgram>
</ExternalProgram>
<StartExternalURL>
</StartExternalURL>
<StartCmdLineArguments>
</StartCmdLineArguments>
<StartWorkingDirectory>
</StartWorkingDirectory>
<EnableENC>False</EnableENC>
<AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
+43
View File
@@ -0,0 +1,43 @@
# I'm Mariam, a t-bot!
AKA a trading algobot running on the AAPlatform by Advanced Algos Ltd.
### My Specialty
I serve as a template for developing trading bots.
### Ideal for
A starting point laying out the proper ways to interact with the AACloud. My actual trading strategy is quite unusable though... you will have to bring your own logic, strategy wise.
### Details
| **Name** | **Type** | **Version** | **Release Date** | **Current dataSet** |
|----------|----------|----------|----------|----------|
| Mariam |Trading | 1.0 | Jan 2018 | dataSet.V1 |
# My Strategy
### Markets
* **Exchanges**: Poloniex
* **Markets**: USDT-BTC
### Description
> WARNING: The trading strategy behind Mariam is far from being a good strategy, let alone a proven one.
I start out trying to sell BTC at the highest possible price, but, in all honesty, I don't do much to ensure that. I just sell and hope the price will rise.
### Compatible Plotters
[AAMasters Plotters-Trading](https://github.com/AAMasters/Plotters-Trading)
### Dependencies
[AAMasters Charly](https://github.com/AAMasters/AACharly-Extraction-Bot)
[AAMasters Bruce](https://github.com/AAMasters/AABruce-Indicator-Bot)
[AAMasters Olivia](https://github.com/AAMasters/AAOlivia-Indicator-Bot)
### Trading as a Service (TaaS) Fees
No fees.
# Disclaimer
THE AA MASTERS BOTS AND THEIR ASSOCIATED PRODUCTS AND SERVICES ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, SUITABILITY FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
IN NO EVENT WILL ADVANCED ALGOS BE LIABLE TO ANY PARTY FOR ANY DIRECT, INDIRECT, SPECIAL OR OTHER CONSEQUENTIAL DAMAGES FOR ANY USE OF THE AACLOUD, THE AA ARENA COMPETITION, THE AA MASTERS BOTS, OR ANY OTHER ASSOCIATED SERVICE OR WEB SITE, INCLUDING, WITHOUT LIMITATION, ANY LOST PROFITS, BUSINESS INTERRUPTION, LOSS OF FUNDS, PROGRAMS OR OTHER DATA OR OTHERWISE, EVEN IF WE ARE EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+205
View File
@@ -0,0 +1,205 @@
exports.newUserBot = function newUserBot(bot, logger) {
const MODULE_NAME = 'User Bot';
const FULL_LOG = true;
const ERROR_LOG = true;
let thisObject = {
initialize: initialize,
start: start
};
let assistant; // You will receive a reference to the platform at your initialize function.
return thisObject;
function initialize(pAssistant, callBackFunction) {
try {
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] initialize -> Entering function.'); }
logger.fileName = MODULE_NAME;
/* Store local values. */
assistant = pAssistant;
callBackFunction(global.DEFAULT_OK_RESPONSE);
} catch (err) {
if (ERROR_LOG === true) { logger.write(MODULE_NAME, '[ERROR] initialize -> onDone -> err = ' + err.message); }
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
function start(callBackFunction) {
try {
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> Entering function.'); }
/*
This is an example. This bot will trade with a pseudo strategy based on candle and volumes stairs patterns.
Essentially it will look at the patterns it is in at different time periods and try to make a guess if it is a good time to buy,
sell, or do nothing.
*/
if (global.AT_BREAKPOINT === true) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> Plot Breakpoint Hit."); }
}
decideWhatToDo(onDone);
function onDone(err) {
try {
switch (err.result) {
case global.DEFAULT_OK_RESPONSE.result: {
if (FULL_LOG === true) { logger.write(MODULE_NAME, '[INFO] start -> onDone -> Execution finished well.'); }
callBackFunction(global.DEFAULT_OK_RESPONSE);
return;
}
break;
case global.DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
if (ERROR_LOG === true) { logger.write(MODULE_NAME, '[ERROR] start -> onDone -> Retry Later. Requesting Execution Retry.'); }
callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
}
break;
case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
if (ERROR_LOG === true) { logger.write(MODULE_NAME, '[ERROR] start -> onDone -> Operation Failed. Aborting the process.'); }
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
return;
}
break;
}
} catch (err) {
if (ERROR_LOG === true) { logger.write(MODULE_NAME, '[ERROR] start -> onDone -> err = ' + err.message); }
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
function decideWhatToDo(callBack) {
try {
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> decideWhatToDo -> Entering function.'); }
let balance = assistant.getAvailableBalance();
let rate = assistant.getMarketRate();
rate = Number(rate.toFixed(8));
let amountA;
let amountB;
let balanceA = Number(balance.assetA);
let balanceB = Number(balance.assetB);
if (balanceA === 0 && balanceB === 0) {
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> decideWhatToDo -> Cannot place orders since Available Balance is zero on both Assets.'); }
callBack(global.DEFAULT_OK_RESPONSE);
return;
let messageRelevance = Math.trunc(Math.random() * 10);
switch (messageRelevance) {
case 1: {
assistant.sendMessage(messageRelevance, 'No Available Balance','Cannot place orders since Available Balance is zero on both Assets.');
break;
}
case 3: {
assistant.sendMessage(messageRelevance, 'Available Balance Too Low', 'Available balances too low on both assets.');
break;
}
case 5: {
assistant.sendMessage(messageRelevance, 'Orders Already at Order Book', 'All intended orders have already been put at the order book.');
break;
}
}
}
if (Math.random() * 10 > 3) {
let messageRelevance = Math.trunc(Math.random() * 6);
switch (messageRelevance) {
case 1: {
assistant.sendMessage(messageRelevance, 'Feeling Lazy', 'I dont feel like putting any order by now. Will think about it later.');
break;
}
case 3: {
assistant.sendMessage(messageRelevance, 'Not Right Time', 'According to my internal calculations, this is not a good time to place an order.');
break;
}
case 5: {
assistant.sendMessage(messageRelevance, 'Not Feeling Lucky', 'I am currently not feeling lucky, for that reason I wont put any order now.');
break;
}
}
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> decideWhatToDo -> In some situations it is just fin no to place orders. Passing this turn. '); }
callBack(global.DEFAULT_OK_RESPONSE);
return;
}
if (balanceA > 0) {
amountA = balanceA;
amountA = Number(amountA.toFixed(8));
amountB = amountA / rate;
amountB = Number(amountB.toFixed(8));
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> decideWhatToDo -> Decided to BUY.'); }
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> decideWhatToDo -> amountA = ' + amountA); }
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> decideWhatToDo -> amountB = ' + amountB); }
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> decideWhatToDo -> rate = ' + rate); }
assistant.putPosition('buy', rate, amountA, amountB, callBack);
assistant.sendMessage(10, 'Buy Order Placed', 'I ve just placed a Buy order because I thought the rate ' + rate + ' was great.');
}
if (balanceB > 0) {
amountB = balanceB;
amountB = Number(amountB.toFixed(8));
amountA = amountB * rate;
amountA = Number(amountA.toFixed(8));
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> decideWhatToDo -> Decided to SELL.'); }
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> decideWhatToDo -> amountA = ' + amountA); }
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> decideWhatToDo -> amountB = ' + amountB); }
if (FULL_LOG === true) { logger.write( MODULE_NAME, '[INFO] start -> decideWhatToDo -> rate = ' + rate); }
assistant.putPosition('sell', rate, amountA, amountB, callBack);
assistant.sendMessage(10, 'Sell Order Placed', 'I ve just placed a Sell order because I believe it was the right time to do so.');
}
} catch (err) {
if (ERROR_LOG === true) { logger.write(MODULE_NAME, '[ERROR] start -> decideWhatToDo -> err = ' + err.message); }
callBack(global.DEFAULT_FAIL_RESPONSE);
}
}
} catch (err) {
if (ERROR_LOG === true) { logger.write(MODULE_NAME, '[ERROR] start -> err = ' + err.message); }
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
};
+13
View File
@@ -0,0 +1,13 @@
{
"name": "AAMariam",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Luis-Fernando-Molina",
"license": "ISC",
"dependencies": {
}
}
+169
View File
@@ -0,0 +1,169 @@
{
"displayName": "Mariam",
"codeName": "AAMariam",
"type": "Trading",
"version": {
"major": 1,
"minor": 0,
"patch": 0
},
"devTeam": "AAMasters",
"profilePicture": "Mariam.png",
"dataSetVersion": "dataSet.V1",
"processes": [
{
"name": "Trading-Process",
"description": "Simple trading strategy to be used as a template.",
"startMode": {
"live": {
"run": "false",
"resumeExecution": "false"
},
"backtest": {
"run": "true",
"beginDatetime": "2018-04-21T18:00:00.000Z",
"endDatetime": "2018-04-21T18:15:00.000Z",
"waitTime": 1000
},
"competition": {
"run": "false",
"beginDatetime": "2018-05-17T00:00:00.000Z",
"endDatetime": "2018-05-18T00:00:00.000Z",
"resumeExecution": "false"
}
},
"normalWaitTime": 60000,
"retryWaitTime": 10000,
"sleepWaitTime": 3600000,
"comaWaitTime": 86400000,
"timePeriod": 60000,
"statusDependencies": [
{
"devTeam": "AAMasters",
"bot": "AAMariam",
"botVersion": {
"major": 1,
"minor": 0
},
"process": "Trading-Process",
"dataSetVersion": "dataSet.V1"
}
],
"dataDependencies": [
{
"devTeam": "AAMasters",
"bot": "AAOlivia",
"botVersion": {
"major": 1,
"minor": 0
},
"product": "Candles",
"dataSet": "Multi-Period-Market",
"dataSetVersion": "dataSet.V1"
},
{
"devTeam": "AAMasters",
"bot": "AAOlivia",
"botVersion": {
"major": 1,
"minor": 0
},
"product": "Candles",
"dataSet": "Multi-Period-Daily",
"dataSetVersion": "dataSet.V1"
},
{
"devTeam": "AAMasters",
"bot": "AABruce",
"botVersion": {
"major": 1,
"minor": 0
},
"product": "Candles",
"dataSet": "One-Min",
"dataSetVersion": "dataSet.V1"
}
]
}
],
"products": [
{
"codeName": "Live Trading History",
"displayName": "Live Trading History",
"shortDisplayName": "Live",
"description": "General information about Mariam live trading history.",
"dataSets": [
{
"codeName": "Live History",
"type": "File Sequence",
"validPeriods": [ "24-hs", "12-hs", "08-hs", "06-hs", "04-hs", "03-hs", "02-hs", "01-hs", "45-min", "40-min", "30-min", "20-min", "15-min", "10-min", "05-min", "04-min", "03-min", "02-min", "01-min" ],
"filePath": "@DevTeam/@Bot.1.0/AACloud.1.1/Poloniex/dataSet.V1/Output/Trading-Process",
"fileName": "Execution.History.Live.@Sequence.json"
}
],
"exchangeList": [
{
"name": "Poloniex"
}
],
"plotter": {
"devTeam": "AAMasters",
"codeName": "PlottersTrading",
"moduleName": "History"
}
},
{
"codeName": "Backtest Trading History",
"displayName": "Backtest Trading History",
"shortDisplayName": "Backtest",
"description": "General information about Mariam backtest trading history.",
"dataSets": [
{
"codeName": "Backtest History",
"type": "File Sequence",
"validPeriods": [ "24-hs", "12-hs", "08-hs", "06-hs", "04-hs", "03-hs", "02-hs", "01-hs", "45-min", "40-min", "30-min", "20-min", "15-min", "10-min", "05-min", "04-min", "03-min", "02-min", "01-min" ],
"filePath": "@DevTeam/@Bot.1.0/AACloud.1.1/Poloniex/dataSet.V1/Output/Trading-Process",
"fileName": "Execution.History.Backtest.@Sequence.json"
}
],
"exchangeList": [
{
"name": "Poloniex"
}
],
"plotter": {
"devTeam": "AAMasters",
"codeName": "PlottersTrading",
"moduleName": "History"
}
},
{
"codeName": "Competition Trading History",
"displayName": "Competition Trading History",
"shortDisplayName": "Competition",
"description": "General information about Mariam competition trading history.",
"dataSets": [
{
"codeName": "Competition History",
"type": "File Sequence",
"validPeriods": [ "24-hs", "12-hs", "08-hs", "06-hs", "04-hs", "03-hs", "02-hs", "01-hs", "45-min", "40-min", "30-min", "20-min", "15-min", "10-min", "05-min", "04-min", "03-min", "02-min", "01-min" ],
"filePath": "@DevTeam/@Bot.1.0/AACloud.1.1/Poloniex/dataSet.V1/Output/Trading-Process",
"fileName": "Execution.History.Competition.@Sequence.json"
}
],
"exchangeList": [
{
"name": "Poloniex"
}
],
"plotter": {
"devTeam": "AAMasters",
"codeName": "PlottersTrading",
"moduleName": "History"
}
}
]
}