Merge pull request #1 from AAVikings/master
Adding stable version for integration
This commit is contained in:
54 files changed
+5080
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# Ignore files to be uploaded to the image
|
||||
.env
|
||||
.env.dev
|
||||
.env.prod
|
||||
.git
|
||||
.gitignore
|
||||
Dockerfile
|
||||
Dockerfile.prod
|
||||
README.md
|
||||
CODE_OF_CONDUCT.md
|
||||
CONTRIBUTING.md
|
||||
|
||||
/coverage
|
||||
/.nyc_output
|
||||
@@ -0,0 +1,6 @@
|
||||
NODE_ENV=production
|
||||
PORT=4011
|
||||
|
||||
MONGO_URL=mongodb://mongo/saweb
|
||||
|
||||
PRESHARED_GATEWAY_KEY=saweb_key
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Dependency directories
|
||||
/node_modules
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
# Build folder js files
|
||||
build/
|
||||
dist/
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode
|
||||
|
||||
#Mac specific files
|
||||
.DS_Store
|
||||
@@ -0,0 +1,46 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team using the online form in the contacts page of the superalgos.org website. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
@@ -0,0 +1,9 @@
|
||||
# Contributing
|
||||
|
||||
We are thrilled you are interested in contributing to this repository. Your help may be essential to the project's success and we want you in!
|
||||
|
||||
Superalgos is a collective project, currently at a very early stage. We not only welcome contributions but may even choose to incentivize relevant contributions via the project's native crypto token.
|
||||
|
||||
Please read the [Join the Dev Team]( https://superalgos.org/developers-join-dev-team.shtml) page in our website to learn more about how you may become a relevant member of the Community and even make a living out of contributing code to the project.
|
||||
|
||||
Contributions are deemed _voluntary work_, irrespective of the incentives that may be in place, and are subject to the conditions described in the LICENSE
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
FROM mhart/alpine-node:12
|
||||
|
||||
# Directory where the service will be installed
|
||||
ARG API_DIR=/usr/src/saweb-api
|
||||
|
||||
# Prepare required directories
|
||||
RUN mkdir -p ${API_DIR}
|
||||
|
||||
# Use app directory as current workdir
|
||||
WORKDIR ${API_DIR}
|
||||
|
||||
# Copy package.json to workdir
|
||||
COPY . ${API_DIR}/
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install --production
|
||||
|
||||
# Expose Port
|
||||
EXPOSE $PORT
|
||||
@@ -0,0 +1,21 @@
|
||||
FROM mhart/alpine-node:8
|
||||
|
||||
ENV PORT=4004
|
||||
|
||||
RUN mkdir -p /var/www/app && \
|
||||
mkdir -p /var/www/app/node_modules
|
||||
|
||||
# Use app directory as current workdir
|
||||
WORKDIR /var/www/app
|
||||
ENV PATH /var/www/app/node_modules/.bin:$PATH
|
||||
# Copy package.json to workdir
|
||||
COPY package.json /var/www/app/package.json
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy application code
|
||||
COPY . /var/www/app
|
||||
|
||||
# Expose Port
|
||||
EXPOSE $PORT
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,24 @@
|
||||
version: '3'
|
||||
services:
|
||||
node:
|
||||
image: saweb-api:v1
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./Dockerfile.prod
|
||||
env_file: ./.env
|
||||
container_name: saweb-api
|
||||
tty: true
|
||||
stdin_open: true
|
||||
volumes:
|
||||
- ./:/var/www/app
|
||||
- /var/www/app/node_modules
|
||||
working_dir: /var/www/app
|
||||
restart: always
|
||||
command: npm start
|
||||
expose:
|
||||
- 4004
|
||||
network_mode: webproxy
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: webproxy
|
||||
Generated
+2219
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "saweb-api",
|
||||
"version": "0.1.0",
|
||||
"description": "Superalgos Web backend API",
|
||||
"author": "Superalgos, ltd.",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Superalgos/SAWebServer.git"
|
||||
},
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"express": "^4.16.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@azure/storage-blob": "^10.3.0",
|
||||
"apollo-server-express": "2.1.0",
|
||||
"axios": "0.18.0",
|
||||
"azure-storage": "^2.10.3",
|
||||
"dotenv": "6.0.0",
|
||||
"esm": "^3.2.22",
|
||||
"express": "4.16.3",
|
||||
"graphql": "0.13.2",
|
||||
"json-beautify": "^1.1.0",
|
||||
"mongoose": "5.3.4",
|
||||
"winston": "3.2.1"
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
import 'dotenv/config';
|
||||
import express from 'express';
|
||||
import { ApolloServer } from 'apollo-server-express';
|
||||
import schema from './schema';
|
||||
import wrongPreshared from './errors/notAllowed.json';
|
||||
import db from './db';
|
||||
import logger from './utils/logger'
|
||||
|
||||
const app = express();
|
||||
|
||||
app.post('/graphql', (req, res, next) => {
|
||||
if (req.headers.preshared === process.env.PRESHARED_GATEWAY_KEY) {
|
||||
next();
|
||||
} else {
|
||||
res.send(wrongPreshared);
|
||||
}
|
||||
});
|
||||
|
||||
// Starting the graphql server
|
||||
const server = new ApolloServer({
|
||||
schema,
|
||||
playground: {
|
||||
settings: {
|
||||
'editor.theme': 'dark',
|
||||
'editor.cursorShape': 'line',
|
||||
},
|
||||
},
|
||||
context: ({ req }) => ({
|
||||
userId: req.headers.userid,
|
||||
authorization: req.headers.authorization,
|
||||
}),
|
||||
formatError: error => ({
|
||||
code: error.extensions.exception.code,
|
||||
message: error.message,
|
||||
path: error.path,
|
||||
}),
|
||||
introspection: true,
|
||||
});
|
||||
|
||||
server.applyMiddleware({
|
||||
app,
|
||||
cors: true,
|
||||
});
|
||||
|
||||
db.on('error', (err) => {
|
||||
logger.error(err);
|
||||
});
|
||||
db.once('open', () => {
|
||||
logger.info('Connected to the DB.');
|
||||
});
|
||||
|
||||
app.listen(process.env.PORT, () => {
|
||||
logger.info(`Listening on port ${process.env.PORT}`);
|
||||
});
|
||||
@@ -0,0 +1,886 @@
|
||||
{
|
||||
"authId": "",
|
||||
"devTeams": [
|
||||
{
|
||||
"codeName": "AAMasters",
|
||||
"displayName": "Masters",
|
||||
"host": {
|
||||
"url": "http://localhost:4100/",
|
||||
"storage": "https://aadevelop.blob.core.windows.net",
|
||||
"container": "aamasters",
|
||||
"accessKey": "?st=2019-05-21T12%3A00%3A00Z&se=2020-05-22T12%3A00%3A00Z&sp=rl&sv=2018-03-28&sr=c&sig=PsGM67klPfLjdfjymziEQEQcD5Wzy3SMcZWsTCQrhd8%3D"
|
||||
},
|
||||
"bots": [
|
||||
{
|
||||
"codeName": "AAOlivia",
|
||||
"displayName": "Olivia",
|
||||
"type": "Indicator",
|
||||
"profilePicture": "Olivia.png",
|
||||
"repo": "AAOlivia-Indicator-Bot",
|
||||
"configFile": "this.bot.config.json",
|
||||
"products": [
|
||||
{
|
||||
"codeName": "Candles",
|
||||
"displayName": "Candles",
|
||||
"description": "Two sets of files per period that contains candles.",
|
||||
"dataSets": [
|
||||
{
|
||||
"codeName": "Multi-Period-Market",
|
||||
"type": "Market Files",
|
||||
"validPeriods": [
|
||||
"24-hs",
|
||||
"12-hs",
|
||||
"08-hs",
|
||||
"06-hs",
|
||||
"04-hs",
|
||||
"03-hs",
|
||||
"02-hs",
|
||||
"01-hs"
|
||||
],
|
||||
"filePath": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candles/Multi-Period-Market/@Period",
|
||||
"fileName": "@AssetA_@AssetB.json"
|
||||
},
|
||||
{
|
||||
"codeName": "Multi-Period-Daily",
|
||||
"type": "Daily Files",
|
||||
"validPeriods": [
|
||||
"45-min",
|
||||
"40-min",
|
||||
"30-min",
|
||||
"20-min",
|
||||
"15-min",
|
||||
"10-min",
|
||||
"05-min",
|
||||
"04-min",
|
||||
"03-min",
|
||||
"02-min",
|
||||
"01-min"
|
||||
],
|
||||
"filePath": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candles/Multi-Period-Daily/@Period/@Year/@Month/@Day",
|
||||
"fileName": "@AssetA_@AssetB.json",
|
||||
"dataRange": {
|
||||
"filePath": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candles/Multi-Period-Daily",
|
||||
"fileName": "Data.Range.@AssetA_@AssetB.json"
|
||||
}
|
||||
}
|
||||
],
|
||||
"exchangeList": [
|
||||
{
|
||||
"name": "Poloniex"
|
||||
},
|
||||
{
|
||||
"name": "Coss"
|
||||
}
|
||||
],
|
||||
"plotter": {
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersCandlesVolumes",
|
||||
"moduleName": "Candles"
|
||||
}
|
||||
},
|
||||
{
|
||||
"codeName": "Volumes",
|
||||
"displayName": "Buy and Sell Volumes",
|
||||
"description": "Two sets of files per period that contains buy and sell volumes.",
|
||||
"dataSets": [
|
||||
{
|
||||
"codeName": "Multi-Period-Market",
|
||||
"type": "Market Files",
|
||||
"validPeriods": [
|
||||
"24-hs",
|
||||
"12-hs",
|
||||
"08-hs",
|
||||
"06-hs",
|
||||
"04-hs",
|
||||
"03-hs",
|
||||
"02-hs",
|
||||
"01-hs"
|
||||
],
|
||||
"filePath": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volumes/Multi-Period-Market/@Period",
|
||||
"fileName": "@AssetA_@AssetB.json"
|
||||
},
|
||||
{
|
||||
"codeName": "Multi-Period-Daily",
|
||||
"type": "Daily Files",
|
||||
"validPeriods": [
|
||||
"45-min",
|
||||
"40-min",
|
||||
"30-min",
|
||||
"20-min",
|
||||
"15-min",
|
||||
"10-min",
|
||||
"05-min",
|
||||
"04-min",
|
||||
"03-min",
|
||||
"02-min",
|
||||
"01-min"
|
||||
],
|
||||
"filePath": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volumes/Multi-Period-Daily/@Period/@Year/@Month/@Day",
|
||||
"fileName": "@AssetA_@AssetB.json",
|
||||
"dataRange": {
|
||||
"filePath": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volumes/Multi-Period-Daily",
|
||||
"fileName": "Data.Range.@AssetA_@AssetB.json"
|
||||
}
|
||||
}
|
||||
],
|
||||
"exchangeList": [
|
||||
{
|
||||
"name": "Poloniex"
|
||||
},
|
||||
{
|
||||
"name": "Coss"
|
||||
}
|
||||
],
|
||||
"plotter": {
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersCandlesVolumes",
|
||||
"moduleName": "Volumes"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codeName": "AATom",
|
||||
"displayName": "Tom",
|
||||
"type": "Indicator",
|
||||
"profilePicture": "Tom.png",
|
||||
"repo": "AATom-Indicator-Bot",
|
||||
"configFile": "this.bot.config.json",
|
||||
"products": [
|
||||
{
|
||||
"codeName": "Candle-Stairs",
|
||||
"displayName": "Candle-Stairs Patters",
|
||||
"description": "Two sets of files per period that contains candle-stairs patterns.",
|
||||
"dataSets": [
|
||||
{
|
||||
"codeName": "Multi-Period-Market",
|
||||
"type": "Market Files",
|
||||
"validPeriods": [
|
||||
"24-hs",
|
||||
"12-hs",
|
||||
"08-hs",
|
||||
"06-hs",
|
||||
"04-hs",
|
||||
"03-hs",
|
||||
"02-hs",
|
||||
"01-hs"
|
||||
],
|
||||
"filePath": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candle-Stairs/Multi-Period-Market/@Period",
|
||||
"fileName": "@AssetA_@AssetB.json"
|
||||
},
|
||||
{
|
||||
"codeName": "Multi-Period-Daily",
|
||||
"type": "Daily Files",
|
||||
"validPeriods": [
|
||||
"45-min",
|
||||
"40-min",
|
||||
"30-min",
|
||||
"20-min",
|
||||
"15-min",
|
||||
"10-min",
|
||||
"05-min",
|
||||
"04-min",
|
||||
"03-min",
|
||||
"02-min",
|
||||
"01-min"
|
||||
],
|
||||
"filePath": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candle-Stairs/Multi-Period-Daily/@Period/@Year/@Month/@Day",
|
||||
"fileName": "@AssetA_@AssetB.json",
|
||||
"dataRange": {
|
||||
"filePath": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candle-Stairs/Multi-Period-Daily",
|
||||
"fileName": "Data.Range.@AssetA_@AssetB.json"
|
||||
}
|
||||
}
|
||||
],
|
||||
"exchangeList": [
|
||||
{
|
||||
"name": "Poloniex"
|
||||
},
|
||||
{
|
||||
"name": "Coss"
|
||||
}
|
||||
],
|
||||
"plotter": {
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersStairsPatterns",
|
||||
"moduleName": "CandleStairs"
|
||||
}
|
||||
},
|
||||
{
|
||||
"codeName": "Volume-Stairs",
|
||||
"displayName": "Volume-Stairs Patters",
|
||||
"description": "Two sets of files per period that contains volume-stairs patterns.",
|
||||
"dataSets": [
|
||||
{
|
||||
"codeName": "Multi-Period-Market",
|
||||
"type": "Market Files",
|
||||
"validPeriods": [
|
||||
"24-hs",
|
||||
"12-hs",
|
||||
"08-hs",
|
||||
"06-hs",
|
||||
"04-hs",
|
||||
"03-hs",
|
||||
"02-hs",
|
||||
"01-hs"
|
||||
],
|
||||
"filePath": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volume-Stairs/Multi-Period-Market/@Period",
|
||||
"fileName": "@AssetA_@AssetB.json"
|
||||
},
|
||||
{
|
||||
"codeName": "Multi-Period-Daily",
|
||||
"type": "Daily Files",
|
||||
"validPeriods": [
|
||||
"45-min",
|
||||
"40-min",
|
||||
"30-min",
|
||||
"20-min",
|
||||
"15-min",
|
||||
"10-min",
|
||||
"05-min",
|
||||
"04-min",
|
||||
"03-min",
|
||||
"02-min",
|
||||
"01-min"
|
||||
],
|
||||
"filePath": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volume-Stairs/Multi-Period-Daily/@Period/@Year/@Month/@Day",
|
||||
"fileName": "@AssetA_@AssetB.json",
|
||||
"dataRange": {
|
||||
"filePath": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volume-Stairs/Multi-Period-Daily",
|
||||
"fileName": "Data.Range.@AssetA_@AssetB.json"
|
||||
}
|
||||
}
|
||||
],
|
||||
"exchangeList": [
|
||||
{
|
||||
"name": "Poloniex"
|
||||
},
|
||||
{
|
||||
"name": "Coss"
|
||||
}
|
||||
],
|
||||
"plotter": {
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersStairsPatterns",
|
||||
"moduleName": "VolumeStairs"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codeName": "AAChris",
|
||||
"displayName": "Chris",
|
||||
"type": "Indicator",
|
||||
"profilePicture": "Chris.png",
|
||||
"repo": "AAChris-Indicator-Bot",
|
||||
"configFile": "this.bot.config.json",
|
||||
"products": [
|
||||
{
|
||||
"codeName": "Bollinger-Bands",
|
||||
"displayName": "Bollinger Bands",
|
||||
"description": "Bollinger Bands",
|
||||
"dataSets": [
|
||||
{
|
||||
"codeName": "Multi-Period-Market",
|
||||
"type": "Market Files",
|
||||
"validPeriods": [
|
||||
"24-hs",
|
||||
"12-hs",
|
||||
"08-hs",
|
||||
"06-hs",
|
||||
"04-hs",
|
||||
"03-hs",
|
||||
"02-hs",
|
||||
"01-hs"
|
||||
],
|
||||
"filePath": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Bands/Multi-Period-Market/@Period",
|
||||
"fileName": "@AssetA_@AssetB.json"
|
||||
},
|
||||
{
|
||||
"codeName": "Multi-Period-Daily",
|
||||
"type": "Daily Files",
|
||||
"validPeriods": [
|
||||
"45-min",
|
||||
"40-min",
|
||||
"30-min",
|
||||
"20-min",
|
||||
"15-min",
|
||||
"10-min",
|
||||
"05-min",
|
||||
"04-min",
|
||||
"03-min",
|
||||
"02-min",
|
||||
"01-min"
|
||||
],
|
||||
"filePath": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Bands/Multi-Period-Daily/@Period/@Year/@Month/@Day",
|
||||
"fileName": "@AssetA_@AssetB.json",
|
||||
"dataRange": {
|
||||
"filePath": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Bands/Multi-Period-Daily",
|
||||
"fileName": "Data.Range.@AssetA_@AssetB.json"
|
||||
}
|
||||
}
|
||||
],
|
||||
"exchangeList": [
|
||||
{
|
||||
"name": "Poloniex"
|
||||
},
|
||||
{
|
||||
"name": "Coss"
|
||||
}
|
||||
],
|
||||
"plotter": {
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersBollingerBands",
|
||||
"moduleName": "BollingerBands"
|
||||
}
|
||||
},
|
||||
{
|
||||
"codeName": "Percentage-Bandwidth",
|
||||
"displayName": "Percentage Bandwidth",
|
||||
"description": "Percentage Bandwidth",
|
||||
"dataSets": [
|
||||
{
|
||||
"codeName": "Multi-Period-Market",
|
||||
"type": "Market Files",
|
||||
"validPeriods": [
|
||||
"24-hs",
|
||||
"12-hs",
|
||||
"08-hs",
|
||||
"06-hs",
|
||||
"04-hs",
|
||||
"03-hs",
|
||||
"02-hs",
|
||||
"01-hs"
|
||||
],
|
||||
"filePath": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Percentage-Bandwidth/Multi-Period-Market/@Period",
|
||||
"fileName": "@AssetA_@AssetB.json"
|
||||
},
|
||||
{
|
||||
"codeName": "Multi-Period-Daily",
|
||||
"type": "Daily Files",
|
||||
"validPeriods": [
|
||||
"45-min",
|
||||
"40-min",
|
||||
"30-min",
|
||||
"20-min",
|
||||
"15-min",
|
||||
"10-min",
|
||||
"05-min",
|
||||
"04-min",
|
||||
"03-min",
|
||||
"02-min",
|
||||
"01-min"
|
||||
],
|
||||
"filePath": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Percentage-Bandwidth/Multi-Period-Daily/@Period/@Year/@Month/@Day",
|
||||
"fileName": "@AssetA_@AssetB.json",
|
||||
"dataRange": {
|
||||
"filePath": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Percentage-Bandwidth/Multi-Period-Daily",
|
||||
"fileName": "Data.Range.@AssetA_@AssetB.json"
|
||||
}
|
||||
}
|
||||
],
|
||||
"exchangeList": [
|
||||
{
|
||||
"name": "Poloniex"
|
||||
},
|
||||
{
|
||||
"name": "Coss"
|
||||
}
|
||||
],
|
||||
"plotter": {
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersBollingerBands",
|
||||
"moduleName": "PercentageBandwidth"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codeName": "AAPaula",
|
||||
"displayName": "Paula",
|
||||
"type": "Indicator",
|
||||
"profilePicture": "Paula.png",
|
||||
"repo": "AAPaula-Indicator-Bot",
|
||||
"configFile": "this.bot.config.json",
|
||||
"products": [
|
||||
{
|
||||
"codeName": "Bollinger-Channels",
|
||||
"displayName": "Bollinger-Channels",
|
||||
"description": "Two sets of files per period that contains band-channel patterns.",
|
||||
"dataSets": [
|
||||
{
|
||||
"codeName": "Multi-Period-Market",
|
||||
"type": "Market Files",
|
||||
"validPeriods": [
|
||||
"24-hs",
|
||||
"12-hs",
|
||||
"08-hs",
|
||||
"06-hs",
|
||||
"04-hs",
|
||||
"03-hs",
|
||||
"02-hs",
|
||||
"01-hs"
|
||||
],
|
||||
"filePath": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Channels/Multi-Period-Market/@Period",
|
||||
"fileName": "@AssetA_@AssetB.json"
|
||||
},
|
||||
{
|
||||
"codeName": "Multi-Period-Daily",
|
||||
"type": "Daily Files",
|
||||
"validPeriods": [
|
||||
"45-min",
|
||||
"40-min",
|
||||
"30-min",
|
||||
"20-min",
|
||||
"15-min",
|
||||
"10-min",
|
||||
"05-min",
|
||||
"04-min",
|
||||
"03-min",
|
||||
"02-min",
|
||||
"01-min"
|
||||
],
|
||||
"filePath": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Channels/Multi-Period-Daily/@Period/@Year/@Month/@Day",
|
||||
"fileName": "@AssetA_@AssetB.json",
|
||||
"dataRange": {
|
||||
"filePath": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Channels/Multi-Period-Daily",
|
||||
"fileName": "Data.Range.@AssetA_@AssetB.json"
|
||||
}
|
||||
}
|
||||
],
|
||||
"exchangeList": [
|
||||
{
|
||||
"name": "Poloniex"
|
||||
},
|
||||
{
|
||||
"name": "Coss"
|
||||
}
|
||||
],
|
||||
"plotter": {
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersBollingerChannels",
|
||||
"moduleName": "BollingerChannels"
|
||||
}
|
||||
},
|
||||
{
|
||||
"codeName": "Bollinger-Sub-Channels",
|
||||
"displayName": "Bollinger-Sub-Channels",
|
||||
"description": "Bollinger Sub Channels with slope.",
|
||||
"dataSets": [
|
||||
{
|
||||
"codeName": "Multi-Period-Market",
|
||||
"type": "Market Files",
|
||||
"validPeriods": [
|
||||
"24-hs",
|
||||
"12-hs",
|
||||
"08-hs",
|
||||
"06-hs",
|
||||
"04-hs",
|
||||
"03-hs",
|
||||
"02-hs",
|
||||
"01-hs"
|
||||
],
|
||||
"filePath": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Sub-Channels/Multi-Period-Market/@Period",
|
||||
"fileName": "@AssetA_@AssetB.json"
|
||||
},
|
||||
{
|
||||
"codeName": "Multi-Period-Daily",
|
||||
"type": "Daily Files",
|
||||
"validPeriods": [
|
||||
"45-min",
|
||||
"40-min",
|
||||
"30-min",
|
||||
"20-min",
|
||||
"15-min",
|
||||
"10-min",
|
||||
"05-min",
|
||||
"04-min",
|
||||
"03-min",
|
||||
"02-min",
|
||||
"01-min"
|
||||
],
|
||||
"filePath": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Sub-Channels/Multi-Period-Daily/@Period/@Year/@Month/@Day",
|
||||
"fileName": "@AssetA_@AssetB.json",
|
||||
"dataRange": {
|
||||
"filePath": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Sub-Channels/Multi-Period-Daily",
|
||||
"fileName": "Data.Range.@AssetA_@AssetB.json"
|
||||
}
|
||||
}
|
||||
],
|
||||
"exchangeList": [
|
||||
{
|
||||
"name": "Poloniex"
|
||||
},
|
||||
{
|
||||
"name": "Coss"
|
||||
}
|
||||
],
|
||||
"plotter": {
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersBollingerChannels",
|
||||
"moduleName": "BollingerSubChannels"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"plotters": [
|
||||
{
|
||||
"displayName": "Plotters Candles & Volumes",
|
||||
"codeName": "PlottersCandlesVolumes",
|
||||
"devTeam": "AAMasters",
|
||||
"modules": [
|
||||
{
|
||||
"codeName": "Candles",
|
||||
"moduleName": "Candles",
|
||||
"description": "Plots traditional red and green candles.",
|
||||
"profilePicture": "Candles.png",
|
||||
"panels": [
|
||||
{
|
||||
"codeName": "CandlePanel",
|
||||
"moduleName": "CandlePanel",
|
||||
"event": "Current Candle Changed"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codeName": "Volumes",
|
||||
"description": "Plots volumes separated in buy and sell.",
|
||||
"moduleName": "Volumes",
|
||||
"profilePicture": "Volumes.png",
|
||||
"panels": [
|
||||
{
|
||||
"codeName": "VolumePanel",
|
||||
"moduleName": "VolumePanel",
|
||||
"event": "Current Volume Changed"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"repo": "Plotters-Candles-Volumes",
|
||||
"configFile": "this.plotter.config.json"
|
||||
},
|
||||
{
|
||||
"displayName": "Plotters Stairs Patterns",
|
||||
"codeName": "PlottersStairsPatterns",
|
||||
"devTeam": "AAMasters",
|
||||
"modules": [
|
||||
{
|
||||
"codeName": "CandleStairs",
|
||||
"moduleName": "CandleStairs",
|
||||
"description": "Plots Candle Stairs patterns.",
|
||||
"profilePicture": "CandleStairs.png",
|
||||
"panels": []
|
||||
},
|
||||
{
|
||||
"codeName": "VolumeStairs",
|
||||
"description": "Plots Volume Stairs patterns.",
|
||||
"moduleName": "VolumeStairs",
|
||||
"profilePicture": "VolumeStairs.png",
|
||||
"panels": []
|
||||
}
|
||||
],
|
||||
"repo": "Plotters-Stairs-Patterns",
|
||||
"configFile": "this.plotter.config.json"
|
||||
},
|
||||
{
|
||||
"displayName": "Plotters Trading",
|
||||
"codeName": "PlottersTrading",
|
||||
"devTeam": "AAMasters",
|
||||
"modules": [
|
||||
{
|
||||
"codeName": "Details",
|
||||
"moduleName": "Details",
|
||||
"description": "Plots trading decitions in an easy to understand way.",
|
||||
"panels": []
|
||||
},
|
||||
{
|
||||
"codeName": "History",
|
||||
"moduleName": "History",
|
||||
"description": "Plots trading history.",
|
||||
"profilePicture": "History.png",
|
||||
"panels": []
|
||||
}
|
||||
],
|
||||
"repo": "Plotters-Trading",
|
||||
"configFile": "this.plotter.config.json"
|
||||
},
|
||||
{
|
||||
"displayName": "Plotters Bollinger Bands",
|
||||
"codeName": "PlottersBollingerBands",
|
||||
"devTeam": "AAMasters",
|
||||
"modules": [
|
||||
{
|
||||
"codeName": "BollingerBands",
|
||||
"moduleName": "BollingerBands",
|
||||
"description": "Plots Bollinger Bands.",
|
||||
"profilePicture": "BollingerBands.png",
|
||||
"panels": [
|
||||
{
|
||||
"codeName": "BollingerBandsPanel",
|
||||
"moduleName": "BollingerBandsPanel",
|
||||
"event": "Current Band Changed"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codeName": "PercentageBandwidth",
|
||||
"moduleName": "PercentageBandwidth",
|
||||
"description": "Plots Bollinger Bands.",
|
||||
"profilePicture": "PercentageBandwidth.png",
|
||||
"panels": []
|
||||
}
|
||||
],
|
||||
"repo": "Plotters-Bollinger-Bands",
|
||||
"configFile": "this.plotter.config.json"
|
||||
},
|
||||
{
|
||||
"displayName": "Plotters Trading Simulation",
|
||||
"codeName": "PlottersTradingSimulation",
|
||||
"devTeam": "AAMasters",
|
||||
"modules": [
|
||||
{
|
||||
"codeName": "TradingSimulation",
|
||||
"moduleName": "TradingSimulation",
|
||||
"description": "Plots Bollinger Records.",
|
||||
"profilePicture": "TradingSimulation.png",
|
||||
"panels": [
|
||||
{
|
||||
"codeName": "TradingSimulationPanel",
|
||||
"moduleName": "TradingSimulationPanel",
|
||||
"event": "Current Record Changed"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codeName": "Conditions",
|
||||
"moduleName": "Conditions",
|
||||
"description": "Plots Simulation Conditions.",
|
||||
"profilePicture": "Conditions.png",
|
||||
"panels": []
|
||||
},
|
||||
{
|
||||
"codeName": "Strategies",
|
||||
"moduleName": "Strategies",
|
||||
"description": "Plots Strategies.",
|
||||
"profilePicture": "Strategies.png",
|
||||
"panels": []
|
||||
},
|
||||
{
|
||||
"codeName": "Trades",
|
||||
"moduleName": "Trades",
|
||||
"description": "Plots Trades.",
|
||||
"profilePicture": "Trades.png",
|
||||
"panels": []
|
||||
},
|
||||
{
|
||||
"codeName": "SimulationExecution",
|
||||
"moduleName": "SimulationExecution",
|
||||
"description": "Plots Simulation Execution.",
|
||||
"profilePicture": "SimulationExecution.png",
|
||||
"panels": []
|
||||
}
|
||||
],
|
||||
"repo": "Plotters-Trading-Simulation",
|
||||
"configFile": "this.plotter.config.json"
|
||||
},
|
||||
{
|
||||
"displayName": "Plotters Bollinger Channels",
|
||||
"codeName": "PlottersBollingerChannels",
|
||||
"devTeam": "AAMasters",
|
||||
"modules": [
|
||||
{
|
||||
"codeName": "BollingerChannels",
|
||||
"moduleName": "BollingerChannels",
|
||||
"description": "Plots Bollinger Channels.",
|
||||
"profilePicture": "BollingerChannels.png",
|
||||
"panels": [
|
||||
{
|
||||
"codeName": "ChannelPanel",
|
||||
"moduleName": "ChannelPanel",
|
||||
"event": "Current Channel Changed"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codeName": "BollingerSubChannels",
|
||||
"moduleName": "BollingerSubChannels",
|
||||
"description": "Plots Bollinger Sub-Channels.",
|
||||
"profilePicture": "BollingerSubChannels.png",
|
||||
"panels": [
|
||||
{
|
||||
"codeName": "SubChannelPanel",
|
||||
"moduleName": "SubChannelPanel",
|
||||
"event": "Current Sub-Channel Changed"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"repo": "Plotters-Bollinger-Channels",
|
||||
"configFile": "this.plotter.config.json"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"codeName": "AAVikings",
|
||||
"displayName": "Vikings",
|
||||
"host": {
|
||||
"url": "http://localhost:4100/",
|
||||
"container": "aavikings",
|
||||
"storage": "https://aadevelop.blob.core.windows.net",
|
||||
"accessKey": "?st=2019-05-20T12%3A00%3A00Z&se=2020-05-21T12%3A00%3A00Z&sp=rl&sv=2018-03-28&sr=c&sig=hJuV9aEP4KVZo5z54FEF1BQtkbksfwkTJFv1FYkHFRg%3D"
|
||||
},
|
||||
"bots": [
|
||||
{
|
||||
"codeName": "AAGauss",
|
||||
"displayName": "Gauss",
|
||||
"type": "Indicator",
|
||||
"profilePicture": "Gauss.png",
|
||||
"repo": "AAGauss-Indicator-Bot",
|
||||
"configFile": "this.bot.config.json",
|
||||
"products": [
|
||||
{
|
||||
"codeName": "LRCPoints",
|
||||
"displayName": "LRCPoints",
|
||||
"description": "Two sets of files per period that contains LRC points.",
|
||||
"dataSets": [
|
||||
{
|
||||
"codeName": "Multi-Period-Market",
|
||||
"type": "Market Files",
|
||||
"validPeriods": [
|
||||
"24-hs",
|
||||
"12-hs",
|
||||
"08-hs",
|
||||
"06-hs",
|
||||
"04-hs",
|
||||
"03-hs",
|
||||
"02-hs",
|
||||
"01-hs"
|
||||
],
|
||||
"filePath": "AAVikings/AAGauss.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/LRC-Points/Multi-Period-Market/@Period",
|
||||
"fileName": "@AssetA_@AssetB.json"
|
||||
},
|
||||
{
|
||||
"codeName": "Multi-Period-Daily",
|
||||
"type": "Daily Files",
|
||||
"validPeriods": [
|
||||
"45-min",
|
||||
"40-min",
|
||||
"30-min",
|
||||
"20-min",
|
||||
"15-min",
|
||||
"10-min",
|
||||
"05-min",
|
||||
"04-min",
|
||||
"03-min",
|
||||
"02-min",
|
||||
"01-min"
|
||||
],
|
||||
"filePath": "AAVikings/AAGauss.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/LRC-Points/Multi-Period-Daily/@Period/@Year/@Month/@Day",
|
||||
"fileName": "@AssetA_@AssetB.json",
|
||||
"dataRange": {
|
||||
"filePath": "AAVikings/AAGauss.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/LRC-Points/Multi-Period-Daily",
|
||||
"fileName": "Data.Range.@AssetA_@AssetB.json"
|
||||
}
|
||||
}
|
||||
],
|
||||
"exchangeList": [
|
||||
{
|
||||
"name": "Poloniex"
|
||||
},
|
||||
{
|
||||
"name": "Coss"
|
||||
}
|
||||
],
|
||||
"plotter": {
|
||||
"devTeam": "AAVikings",
|
||||
"codeName": "PlotterLinearRegressionCurve",
|
||||
"moduleName": "LRC"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"plotters": [
|
||||
{
|
||||
"displayName": "Plotter LRC",
|
||||
"codeName": "PlotterLinearRegressionCurve",
|
||||
"devTeam": "AAVikings",
|
||||
"modules": [
|
||||
{
|
||||
"codeName": "LRC",
|
||||
"moduleName": "LRC",
|
||||
"description": "Plots the linear regression curve.",
|
||||
"profilePicture": "LRC.png",
|
||||
"panels": [
|
||||
{
|
||||
"codeName": "ChannelPanel",
|
||||
"moduleName": "ChannelPanel",
|
||||
"event": "Current LRC Changed"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"repo": "Plotters-Linear-Regression-Curve",
|
||||
"configFile": "this.plotter.config.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"hosts": [
|
||||
{
|
||||
"codeName": "AAMasters",
|
||||
"displayName": "AA Arena",
|
||||
"host": {
|
||||
"url": "http://localhost:4100/",
|
||||
"storage": "https://aadevelop.blob.core.windows.net",
|
||||
"container": "aaplatform",
|
||||
"accessKey": "?sv=2018-03-28&ss=b&srt=co&sp=rw&se=2020-01-04T00:00:00Z&st=2019-01-08T11:25:04Z&spr=https&sig=xZU1PO%2BdtVilqlZp%2BVRWW55LYl8oGZU7x4JnP%2BhMc%2FY%3D"
|
||||
},
|
||||
"competitions": [
|
||||
{
|
||||
"codeName": "Weekend-Deathmatch",
|
||||
"description": "First AA Internal Competition. Bots will be trading during 3 days at the USDT/BTC market of Poloniex to see who can make the gratest return over investment (ROI).",
|
||||
"displayName": "AA Internal Challenge",
|
||||
"startDatetime": "2018-01-01T16:00:00.000Z",
|
||||
"finishDatetime": "2018-01-02T16:00:00.000Z",
|
||||
"formula": "ROI",
|
||||
"plotter": {
|
||||
"devTeam": "AAMasters",
|
||||
"codeName": "PlottersROI",
|
||||
"host": {
|
||||
"url": "http://localhost:4100/",
|
||||
"storage": "https://aadevelop.blob.core.windows.net",
|
||||
"container": "aamasters",
|
||||
"accessKey": "?st=2019-05-21T12%3A00%3A00Z&se=2020-05-22T12%3A00%3A00Z&sp=rl&sv=2018-03-28&sr=c&sig=PsGM67klPfLjdfjymziEQEQcD5Wzy3SMcZWsTCQrhd8%3D"
|
||||
},
|
||||
"moduleName": "CombinedProfits",
|
||||
"repo": "Plotters-ROI"
|
||||
},
|
||||
"rules": [],
|
||||
"prizes": [],
|
||||
"participants": [],
|
||||
"repo": "Weekend-Deathmatch",
|
||||
"configFile": "this.competition.config.json"
|
||||
}
|
||||
],
|
||||
"plotters": [
|
||||
{
|
||||
"displayName": "Plotters ROI",
|
||||
"codeName": "PlottersROI",
|
||||
"devTeam": "AAMasters",
|
||||
"modules": [
|
||||
{
|
||||
"codeName": "CombinedProfits",
|
||||
"moduleName": "CombinedProfits",
|
||||
"description": "Plots participants of a competition by the ROI each one had over time.",
|
||||
"panels": []
|
||||
}
|
||||
],
|
||||
"repo": "Plotters-ROI",
|
||||
"configFile": "this.plotter.config.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
mongoose.connect(process.env.MONGO_URL, { useNewUrlParser: true })
|
||||
mongoose.set('useCreateIndex', true);
|
||||
mongoose.set('useFindAndModify', false);
|
||||
mongoose.Promise = global.Promise;
|
||||
|
||||
const db = mongoose.connection;
|
||||
|
||||
export default db;
|
||||
@@ -0,0 +1,31 @@
|
||||
class ClientError extends Error {
|
||||
constructor(args) {
|
||||
super(args);
|
||||
}
|
||||
}
|
||||
|
||||
class ServerError extends Error {
|
||||
constructor(args) {
|
||||
super(args);
|
||||
}
|
||||
}
|
||||
|
||||
export class AuthenticationError extends ClientError {
|
||||
// code = 401
|
||||
// message = 'Authentication not found, you have to be authenticated to perform this action'
|
||||
}
|
||||
|
||||
export class DatabaseError extends ClientError {
|
||||
// code = 404
|
||||
// message = `Ressource not found : ${this.message}`
|
||||
}
|
||||
|
||||
export class WrongArgumentsError extends ClientError {
|
||||
// code = 400
|
||||
// message = `Wrong arguments : ${this.message}`
|
||||
}
|
||||
|
||||
export class ServiceUnavailableError extends ServerError {
|
||||
// code = 503
|
||||
// message = `At least one service is unresponding ${this.message}`
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"errors": [
|
||||
{
|
||||
"code": 401,
|
||||
"message": "Wait, you're not supposed to be here, go through the gate as everyone else"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
require = require('esm')(module)
|
||||
module.exports = require('./app.js')
|
||||
@@ -0,0 +1,335 @@
|
||||
const mongoose = require('mongoose')
|
||||
const { Schema } = require('mongoose')
|
||||
|
||||
const ecosystemSchema = new Schema({
|
||||
authId: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
devTeams: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
host: {
|
||||
url: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
storage: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
container: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
accessKey: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
bots: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
profilePicture: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
repo: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
configFile: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
products: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
dataSets: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
validPeriods: [{
|
||||
type: String,
|
||||
required: true
|
||||
}],
|
||||
filePath: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
fileName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
dataRange: {
|
||||
filePath: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
fileName: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
},
|
||||
}],
|
||||
exchangeList: [{
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}],
|
||||
plotter: {
|
||||
codeName: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
devTeam: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
}
|
||||
}]
|
||||
}],
|
||||
plotters: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
modules: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
profilePicture: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
panels: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
event: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}],
|
||||
}],
|
||||
repo: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
configFile: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}]
|
||||
}],
|
||||
hosts: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
host: {
|
||||
url: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
storage: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
container: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
accessKey: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
competitions: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
startDatetime: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
finishDatetime: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
formula: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
plotter: {
|
||||
devTeam: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
host: {
|
||||
url: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
storage: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
container: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
accessKey: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
repo: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
participants: [{
|
||||
type: String,
|
||||
required: false
|
||||
}],
|
||||
repo: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
configFile: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}],
|
||||
plotters: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
modules: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
profilePicture: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
panels: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
event: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}],
|
||||
}],
|
||||
repo: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
configFile: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}]
|
||||
}]
|
||||
})
|
||||
|
||||
const Ecosystem = mongoose.model('Ecosystem', ecosystemSchema);
|
||||
|
||||
export default Ecosystem;
|
||||
@@ -0,0 +1,5 @@
|
||||
import Ecosystem from './ecosystem';
|
||||
|
||||
export {
|
||||
Ecosystem
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
import {
|
||||
GraphQLSchema,
|
||||
} from 'graphql';
|
||||
import RootQuery from './queries';
|
||||
import Mutation from './mutations';
|
||||
|
||||
const Schema = new GraphQLSchema({
|
||||
query: RootQuery,
|
||||
mutation: Mutation,
|
||||
});
|
||||
|
||||
export default Schema;
|
||||
@@ -0,0 +1,75 @@
|
||||
import logger from '../../utils/logger'
|
||||
import { AuthenticationError, WrongArgumentsError } from '../../errors'
|
||||
import { TeamType } from '../types'
|
||||
import { Ecosystem } from '../../models'
|
||||
import { TeamInputType } from '../types/input'
|
||||
import { copyBots } from '../../storage/CopyBots'
|
||||
|
||||
export const args = { team: { type: TeamInputType } }
|
||||
|
||||
const resolve = async (parent, { team }, context) => {
|
||||
logger.debug('addTeam -> Entering Function.')
|
||||
|
||||
if (!context.userId) {
|
||||
throw new AuthenticationError()
|
||||
}
|
||||
|
||||
try {
|
||||
let userEcosystem = await Ecosystem.findOne({
|
||||
authId: context.userId
|
||||
})
|
||||
|
||||
if (!userEcosystem) {
|
||||
logger.debug('addTeam -> Ecosystem not found for the user, creating a new one from default.')
|
||||
|
||||
let defaultEcosystem = require('../../config/ecosystem.json')
|
||||
userEcosystem = new Ecosystem(defaultEcosystem)
|
||||
userEcosystem.authId = context.userId
|
||||
}
|
||||
|
||||
for (let i = 0; i < userEcosystem.devTeams.length; i++) {
|
||||
const auxTeam = userEcosystem.devTeams[i];
|
||||
if (auxTeam.codeName === team.codeName) {
|
||||
throw new WrongArgumentsError("The team already exist on the user ecosystem.")
|
||||
}
|
||||
}
|
||||
|
||||
let storage = require ('../../storage/providers/AzureStorage') // Default value
|
||||
if (process.env.STORAGE_PROVIDER === 'Minio') {
|
||||
storage = require ('../../storage/providers/MinioStorage')
|
||||
}
|
||||
|
||||
let containerName = team.codeName
|
||||
await storage.createContainer(containerName)
|
||||
let accessKey = storage.createPrivateAccessKey(containerName, "WRITE", 365)
|
||||
|
||||
let botsConfigurations = await copyBots(storage, team)
|
||||
team.bots = botsConfigurations
|
||||
if (!team.host) {
|
||||
let nodeEndpoint = {
|
||||
url: process.env.SUPERALGOS_NODE_ENDPOINT,
|
||||
storage: process.env.STORAGE_URL,
|
||||
container: team.codeName,
|
||||
accessKey: accessKey,
|
||||
}
|
||||
team.host = nodeEndpoint
|
||||
}
|
||||
|
||||
userEcosystem.devTeams.push(team)
|
||||
await userEcosystem.save()
|
||||
return team
|
||||
} catch (err) {
|
||||
logger.error('addTeam -> Error: %s', err.stack)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
const mutation = {
|
||||
addTeam: {
|
||||
type: TeamType,
|
||||
args,
|
||||
resolve,
|
||||
}
|
||||
}
|
||||
|
||||
export default mutation;
|
||||
@@ -0,0 +1,60 @@
|
||||
import logger from '../../utils/logger'
|
||||
import { AuthenticationError, WrongArgumentsError } from '../../errors'
|
||||
import { TeamType } from '../types'
|
||||
import { Ecosystem } from '../../models'
|
||||
import { DeleteTeamInputType } from '../types/input'
|
||||
import { deleteTeam } from '../../storage/DeleteTeam'
|
||||
|
||||
export const args = { team: { type: DeleteTeamInputType } }
|
||||
|
||||
const resolve = async (parent, { team }, context) => {
|
||||
logger.debug('deleteTeam -> Entering Function.')
|
||||
|
||||
if (!context.userId) {
|
||||
throw new AuthenticationError()
|
||||
}
|
||||
|
||||
try {
|
||||
let userEcosystem = await Ecosystem.findOne({
|
||||
authId: context.userId
|
||||
})
|
||||
|
||||
if (!userEcosystem) {
|
||||
logger.debug('deleteTeam -> Ecosystem not found for the user.')
|
||||
throw new WrongArgumentsError('The user does not have an ecosystem configured.')
|
||||
}
|
||||
|
||||
let teamFound = false
|
||||
for (let i = 0; i < userEcosystem.devTeams.length; i++) {
|
||||
const auxTeam = userEcosystem.devTeams[i]
|
||||
if (auxTeam.codeName === team.codeName) {
|
||||
logger.debug('deleteTeam -> Team found, removing.')
|
||||
teamFound = true
|
||||
await deleteTeam(team)
|
||||
userEcosystem.devTeams.splice(i, 1)
|
||||
await userEcosystem.save()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!teamFound) {
|
||||
throw new WrongArgumentsError('Team was not found on the user ecosystem.')
|
||||
} else {
|
||||
return team
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
logger.error('deleteTeam -> Error: %s', err.stack)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
const mutation = {
|
||||
deleteTeam: {
|
||||
type: TeamType,
|
||||
args,
|
||||
resolve,
|
||||
}
|
||||
}
|
||||
|
||||
export default mutation;
|
||||
@@ -0,0 +1,16 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
} from 'graphql';
|
||||
|
||||
import AddTeamMutation from './AddTeam';
|
||||
import DeleteTeamMutation from './DeleteTeam';
|
||||
|
||||
const Mutation = new GraphQLObjectType({
|
||||
name: 'Mutation',
|
||||
fields: Object.assign(
|
||||
AddTeamMutation,
|
||||
DeleteTeamMutation
|
||||
),
|
||||
});
|
||||
|
||||
export default Mutation;
|
||||
@@ -0,0 +1,42 @@
|
||||
import logger from '../../utils/logger'
|
||||
import { Ecosystem } from '../../models'
|
||||
import { EcosystemType } from '../types'
|
||||
|
||||
const args = {}
|
||||
|
||||
const resolve = async (parent, args, context) => {
|
||||
logger.debug('getEcosystem -> Entering Function.')
|
||||
|
||||
try {
|
||||
if (!context.userId) {
|
||||
logger.debug('getEcosystem -> User not logged in, returning default ecosystem.')
|
||||
let defaultEcosystem = require('../../config/ecosystem.json')
|
||||
return defaultEcosystem
|
||||
} else {
|
||||
let userEcosystem = await Ecosystem.findOne({
|
||||
authId: context.userId
|
||||
})
|
||||
|
||||
if (!userEcosystem) {
|
||||
logger.debug('addTeam -> Ecosystem not found for the user, retrieving default.')
|
||||
let defaultEcosystem = require('../../config/ecosystem.json')
|
||||
return defaultEcosystem
|
||||
}
|
||||
|
||||
return userEcosystem
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error('getEcosystem -> Error: %s', err.stack)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
const query = {
|
||||
getEcosystem: {
|
||||
type: EcosystemType,
|
||||
args,
|
||||
resolve,
|
||||
}
|
||||
}
|
||||
|
||||
export default query
|
||||
@@ -0,0 +1,49 @@
|
||||
import logger from '../../utils/logger'
|
||||
import { FileInputType } from '../types/input'
|
||||
import { GraphQLString } from 'graphql'
|
||||
|
||||
export const args = { file: { type: FileInputType } }
|
||||
|
||||
const resolve = async (parent, { file }, context) => {
|
||||
logger.debug('getFileContent -> Entering Function: ' + file.filePath)
|
||||
|
||||
try {
|
||||
|
||||
let storage = require('../../storage/providers/AzureStorage') // Default value
|
||||
if (process.env.STORAGE_PROVIDER === 'Minio') {
|
||||
storage = require('../storage/providers/MinioStorage')
|
||||
}
|
||||
|
||||
//Temporary fix for plotter and plotter pannels
|
||||
if (file.storage === '' && file.accessKey === ''){
|
||||
let defaultEcosystem = require('../../config/ecosystem.json')
|
||||
for (let index = 0; index < defaultEcosystem.devTeams.length; index++) {
|
||||
const devTeam = defaultEcosystem.devTeams[index];
|
||||
if(devTeam.codeName.toLowerCase() === file.container){
|
||||
file.storage = devTeam.host.storage
|
||||
file.accessKey = devTeam.host.accessKey
|
||||
}
|
||||
}
|
||||
}
|
||||
if (file.storage === '' || file.accessKey === ''){
|
||||
throw "Wrong parameters."
|
||||
}
|
||||
|
||||
let fileContent = await storage.getFileContentRemote(file.container, file.filePath, file.storage, file.accessKey)
|
||||
return fileContent
|
||||
|
||||
} catch (err) {
|
||||
logger.error('getFileContent -> Error: %s', err.stack)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
const query = {
|
||||
fileContent: {
|
||||
type: GraphQLString,
|
||||
args,
|
||||
resolve,
|
||||
}
|
||||
}
|
||||
|
||||
export default query
|
||||
@@ -0,0 +1,16 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
} from 'graphql';
|
||||
|
||||
import EcosystemQuery from './Ecosystem';
|
||||
import FileContentQuery from './FileContent';
|
||||
|
||||
const RootQuery = new GraphQLObjectType({
|
||||
name: 'RootQueryType',
|
||||
fields: Object.assign(
|
||||
EcosystemQuery,
|
||||
FileContentQuery
|
||||
),
|
||||
});
|
||||
|
||||
export default RootQuery;
|
||||
@@ -0,0 +1,27 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { ProductType } from './index'
|
||||
|
||||
const BotType = new GraphQLObjectType({
|
||||
name: 'Bot',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
displayName: { type: GraphQLString },
|
||||
type: { type: GraphQLString },
|
||||
profilePicture: { type: GraphQLString },
|
||||
repo: { type: GraphQLString },
|
||||
configFile: { type: GraphQLString },
|
||||
products: {
|
||||
type: new GraphQLList(ProductType),
|
||||
resolve(parent) {
|
||||
return parent.products;
|
||||
}
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
export default BotType;
|
||||
@@ -0,0 +1,32 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { PlotterReferenceType } from './index';
|
||||
|
||||
const CompetitionType = new GraphQLObjectType({
|
||||
name: 'Competition',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
displayName: { type: GraphQLString },
|
||||
description: { type: GraphQLString },
|
||||
startDatetime: { type: GraphQLString },
|
||||
finishDatetime: { type: GraphQLString },
|
||||
formula: { type: GraphQLString },
|
||||
plotter: {
|
||||
type: PlotterReferenceType,
|
||||
resolve(parent) {
|
||||
return parent.plotter;
|
||||
}
|
||||
},
|
||||
rules:{ type: new GraphQLList(GraphQLString) },
|
||||
prizes:{ type: new GraphQLList(GraphQLString) },
|
||||
participants:{ type: new GraphQLList(GraphQLString) },
|
||||
repo: { type: GraphQLString },
|
||||
configFile: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default CompetitionType;
|
||||
@@ -0,0 +1,14 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString
|
||||
} from 'graphql';
|
||||
|
||||
const DataRangeType = new GraphQLObjectType({
|
||||
name: 'DataRange',
|
||||
fields: () => ({
|
||||
filePath: { type: GraphQLString },
|
||||
fileName: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default DataRangeType;
|
||||
@@ -0,0 +1,21 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { DataRangeType } from './index'
|
||||
|
||||
const DataSetType = new GraphQLObjectType({
|
||||
name: 'DataSet',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
type: { type: GraphQLString },
|
||||
validPeriods: { type: new GraphQLList(GraphQLString) },
|
||||
filePath: { type: GraphQLString },
|
||||
fileName: { type: GraphQLString },
|
||||
dataRange: { type: DataRangeType }
|
||||
}),
|
||||
});
|
||||
|
||||
export default DataSetType;
|
||||
@@ -0,0 +1,31 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLID,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { TeamType, EventHostType } from './index';
|
||||
|
||||
const EcosystemType = new GraphQLObjectType({
|
||||
name: 'Ecosystem',
|
||||
fields: () => ({
|
||||
id: { type: GraphQLID },
|
||||
authId: { type: GraphQLString },
|
||||
userName: { type: GraphQLString }, // TODO this field is temporary, it should be used the user module query
|
||||
devTeams: {
|
||||
type: new GraphQLList(TeamType),
|
||||
resolve(parent) {
|
||||
return parent.devTeams;
|
||||
}
|
||||
},
|
||||
hosts: {
|
||||
type: new GraphQLList(EventHostType),
|
||||
resolve(parent) {
|
||||
return parent.hosts;
|
||||
}
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
export default EcosystemType;
|
||||
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { CompetitionType, PlotterType, HostType } from './index';
|
||||
|
||||
const EventHostType = new GraphQLObjectType({
|
||||
name: 'EventHost',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
displayName: { type: GraphQLString },
|
||||
host: {
|
||||
type: HostType,
|
||||
resolve(parent) {
|
||||
return parent.host;
|
||||
}
|
||||
},
|
||||
container: { type: GraphQLString },
|
||||
accessKey: { type: GraphQLString },
|
||||
competitions: {
|
||||
type: new GraphQLList(CompetitionType),
|
||||
resolve(parent) {
|
||||
return parent.competitions;
|
||||
}
|
||||
},
|
||||
plotters: {
|
||||
type: new GraphQLList(PlotterType),
|
||||
resolve(parent) {
|
||||
return parent.plotters;
|
||||
}
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
export default EventHostType;
|
||||
@@ -0,0 +1,13 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString
|
||||
} from 'graphql';
|
||||
|
||||
const ExchangeType = new GraphQLObjectType({
|
||||
name: 'Exchange',
|
||||
fields: () => ({
|
||||
name: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default ExchangeType;
|
||||
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString
|
||||
} from 'graphql';
|
||||
|
||||
const FileType = new GraphQLObjectType({
|
||||
name: 'File',
|
||||
fields: () => ({
|
||||
container: { type: GraphQLString },
|
||||
filePath: { type: GraphQLString },
|
||||
storage: { type: GraphQLString },
|
||||
accessKey: { type: GraphQLString },
|
||||
fileContent: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default FileType;
|
||||
@@ -0,0 +1,16 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString
|
||||
} from 'graphql';
|
||||
|
||||
const HostType = new GraphQLObjectType({
|
||||
name: 'Host',
|
||||
fields: () => ({
|
||||
url: { type: GraphQLString },
|
||||
storage: { type: GraphQLString },
|
||||
container: { type: GraphQLString },
|
||||
accessKey: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default HostType;
|
||||
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql'
|
||||
|
||||
import { PanelType } from './index'
|
||||
|
||||
const ModuleType = new GraphQLObjectType({
|
||||
name: 'Module',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
moduleName: { type: GraphQLString },
|
||||
description: { type: GraphQLString },
|
||||
profilePicture: { type: GraphQLString },
|
||||
panels: {
|
||||
type: new GraphQLList(PanelType),
|
||||
resolve(parent) {
|
||||
return parent.panels;
|
||||
}
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
export default ModuleType;
|
||||
@@ -0,0 +1,15 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString
|
||||
} from 'graphql';
|
||||
|
||||
const PanelType = new GraphQLObjectType({
|
||||
name: 'Panel',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
moduleName: { type: GraphQLString },
|
||||
event: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default PanelType;
|
||||
@@ -0,0 +1,26 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { ModuleType } from './index'
|
||||
|
||||
const PlotterType = new GraphQLObjectType({
|
||||
name: 'Plotter',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
displayName: { type: GraphQLString },
|
||||
host: { type: GraphQLString },
|
||||
modules: {
|
||||
type: new GraphQLList(ModuleType),
|
||||
resolve(parent) {
|
||||
return parent.modules;
|
||||
}
|
||||
},
|
||||
repo: { type: GraphQLString },
|
||||
configFile: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default PlotterType;
|
||||
@@ -0,0 +1,24 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString
|
||||
} from 'graphql';
|
||||
|
||||
import { HostType } from './index';
|
||||
|
||||
const PlotterReferenceType = new GraphQLObjectType({
|
||||
name: 'PlotterReference',
|
||||
fields: () => ({
|
||||
devTeam: { type: GraphQLString },
|
||||
codeName: { type: GraphQLString },
|
||||
host: {
|
||||
type: HostType,
|
||||
resolve(parent) {
|
||||
return parent.host;
|
||||
}
|
||||
},
|
||||
moduleName: { type: GraphQLString },
|
||||
repo: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default PlotterReferenceType;
|
||||
@@ -0,0 +1,31 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { ExchangeType, DataSetType, PlotterReferenceType } from './index'
|
||||
|
||||
const ProductType = new GraphQLObjectType({
|
||||
name: 'Product',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
displayName: { type: GraphQLString },
|
||||
description: { type: GraphQLString },
|
||||
dataSets: {
|
||||
type: new GraphQLList(DataSetType),
|
||||
resolve(parent) {
|
||||
return parent.dataSets;
|
||||
}
|
||||
},
|
||||
exchangeList: {
|
||||
type: new GraphQLList(ExchangeType),
|
||||
resolve(parent) {
|
||||
return parent.exchangeList;
|
||||
}
|
||||
},
|
||||
plotter: { type: PlotterReferenceType }
|
||||
}),
|
||||
});
|
||||
|
||||
export default ProductType;
|
||||
@@ -0,0 +1,35 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { BotType, PlotterType, HostType } from './index';
|
||||
|
||||
const TeamType = new GraphQLObjectType({
|
||||
name: 'Team',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
displayName: { type: GraphQLString },
|
||||
host: {
|
||||
type: HostType,
|
||||
resolve(parent) {
|
||||
return parent.host;
|
||||
}
|
||||
},
|
||||
bots: {
|
||||
type: new GraphQLList(BotType),
|
||||
resolve(parent) {
|
||||
return parent.bots;
|
||||
}
|
||||
},
|
||||
plotters: {
|
||||
type: new GraphQLList(PlotterType),
|
||||
resolve(parent) {
|
||||
return parent.plotters;
|
||||
}
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
export default TeamType;
|
||||
@@ -0,0 +1,33 @@
|
||||
import TeamType from './Team';
|
||||
import BotType from './Bot';
|
||||
import EventHostType from './EventHost';
|
||||
import HostType from './Host';
|
||||
import EcosystemType from './Ecosystem';
|
||||
import FileType from './File';
|
||||
import PanelType from './Panel';
|
||||
import ModuleType from './Module';
|
||||
import PlotterType from './Plotter';
|
||||
import CompetitionType from './Competition';
|
||||
import PlotterReferenceType from './PlotterReference';
|
||||
import ProductType from './Product';
|
||||
import DataSetType from './DataSet';
|
||||
import DataRangeType from './DataRange';
|
||||
import ExchangeType from './Exchange';
|
||||
|
||||
export {
|
||||
TeamType,
|
||||
BotType,
|
||||
EventHostType,
|
||||
HostType,
|
||||
EcosystemType,
|
||||
FileType,
|
||||
PanelType,
|
||||
ModuleType,
|
||||
PlotterType,
|
||||
CompetitionType,
|
||||
PlotterReferenceType,
|
||||
ProductType,
|
||||
DataSetType,
|
||||
DataRangeType,
|
||||
ExchangeType
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
import {
|
||||
GraphQLInputObjectType,
|
||||
GraphQLString,
|
||||
GraphQLNonNull
|
||||
} from 'graphql';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'BotInput',
|
||||
description: 'Payload for bot input.',
|
||||
fields: () => ({
|
||||
codeName: { type: new GraphQLNonNull(GraphQLString) },
|
||||
displayName: { type: new GraphQLNonNull(GraphQLString) },
|
||||
repo: { type: GraphQLString },
|
||||
configFile: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,18 @@
|
||||
import {
|
||||
GraphQLString,
|
||||
GraphQLInputObjectType,
|
||||
GraphQLNonNull
|
||||
} from 'graphql';
|
||||
|
||||
import { HostInputType } from './index';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'DeleteTeamInput',
|
||||
description: 'Payload for team input',
|
||||
fields: () => ({
|
||||
codeName: { type: new GraphQLNonNull(GraphQLString) },
|
||||
host: { type: HostInputType }
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,19 @@
|
||||
import {
|
||||
GraphQLInputObjectType,
|
||||
GraphQLString,
|
||||
GraphQLNonNull
|
||||
} from 'graphql';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'FileInput',
|
||||
description: 'Payload for file input.',
|
||||
fields: () => ({
|
||||
container: { type: new GraphQLNonNull(GraphQLString) },
|
||||
filePath: { type: new GraphQLNonNull(GraphQLString) },
|
||||
storage: { type: new GraphQLNonNull(GraphQLString) },
|
||||
accessKey: { type: new GraphQLNonNull(GraphQLString) },
|
||||
fileContent: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
GraphQLInputObjectType,
|
||||
GraphQLString
|
||||
} from 'graphql';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'HostInput',
|
||||
description: 'Payload for host input.',
|
||||
fields: () => ({
|
||||
url: { type: GraphQLString },
|
||||
storage: { type: GraphQLString },
|
||||
container: { type: GraphQLString },
|
||||
accessKey: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,21 @@
|
||||
import {
|
||||
GraphQLString,
|
||||
GraphQLInputObjectType,
|
||||
GraphQLNonNull
|
||||
} from 'graphql';
|
||||
|
||||
import { BotInputType, HostInputType } from './index';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'TeamInput',
|
||||
description: 'Payload for team input',
|
||||
fields: () => ({
|
||||
codeName: { type: new GraphQLNonNull(GraphQLString) },
|
||||
displayName: { type: new GraphQLNonNull(GraphQLString) },
|
||||
host: { type: HostInputType },
|
||||
bot: { type: new GraphQLNonNull(BotInputType) },
|
||||
plotter: { type: BotInputType }
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,13 @@
|
||||
import TeamInputType from './Team'
|
||||
import BotInputType from './Bot'
|
||||
import HostInputType from './Host'
|
||||
import FileInputType from './File'
|
||||
import DeleteTeamInputType from './DeleteTeam'
|
||||
|
||||
export {
|
||||
TeamInputType,
|
||||
BotInputType,
|
||||
HostInputType,
|
||||
FileInputType,
|
||||
DeleteTeamInputType
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import beautify from 'json-beautify'
|
||||
import logger from '../utils/logger'
|
||||
|
||||
export const copyBot = async (storage, teamCodeName, botCodeName, botDisplayName) => {
|
||||
try {
|
||||
logger.debug('copyBot started for bot %s', botCodeName)
|
||||
|
||||
let containerName = 'aavikings'
|
||||
let templatePath = 'AAVikings/bots/blumblebee-Trading-Bot'
|
||||
let config = await storage.getFileContent(containerName, templatePath + '/this.bot.config.json')
|
||||
let code = await storage.getFileContent(containerName, templatePath + '/Trading-Process/User.Bot.js')
|
||||
|
||||
// Change config to adapt the new indicator
|
||||
let parsedConfig = JSON.parse(config)
|
||||
parsedConfig.displayName = botDisplayName
|
||||
parsedConfig.codeName = botCodeName
|
||||
parsedConfig.devTeam = teamCodeName
|
||||
parsedConfig.profilePicture = botCodeName + '.png'
|
||||
|
||||
parsedConfig.processes[0].statusDependencies[0].devTeam = teamCodeName
|
||||
parsedConfig.processes[0].statusDependencies[0].bot = botCodeName
|
||||
parsedConfig.processes[0].statusDependencies[1].devTeam = teamCodeName
|
||||
parsedConfig.processes[0].statusDependencies[1].bot = 'simulator-' + botCodeName
|
||||
parsedConfig.processes[0].statusDependencies[2].devTeam = teamCodeName
|
||||
parsedConfig.processes[0].statusDependencies[2].bot = 'simulator-' + botCodeName
|
||||
|
||||
parsedConfig.processes[0].dataDependencies[1].devTeam = teamCodeName
|
||||
parsedConfig.processes[0].dataDependencies[1].bot = 'simulator-' + botCodeName
|
||||
parsedConfig.processes[0].dataDependencies[2].devTeam = teamCodeName
|
||||
parsedConfig.processes[0].dataDependencies[2].bot = 'simulator-' + botCodeName
|
||||
|
||||
// Write the new files
|
||||
let newBotPath = teamCodeName + '/bots/' + botCodeName + '-Trading-Bot'
|
||||
await storage.writeFileContent(teamCodeName, newBotPath + '/this.bot.config.json', beautify(parsedConfig, null, 2, 80))
|
||||
await storage.writeFileContent(teamCodeName, newBotPath + '/Trading-Bot/User.Bot.js', code)
|
||||
|
||||
logger.debug('copyBot completed for bot %s', botCodeName)
|
||||
return parsedConfig
|
||||
} catch (err) {
|
||||
logger.error('copyBot error for bot: %s. %s', botCodeName, err)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
export const removeBot = async (storage, teamCodeName, botCodeName) => {
|
||||
try {
|
||||
logger.debug('removeBot started for bot %s', botCodeName)
|
||||
|
||||
// Delete bot code
|
||||
let newBotPath = teamCodeName + '/bots/' + 'bot-' + botCodeName
|
||||
await storage.deleteBlob(teamCodeName, newBotPath + '/this.bot.config.json')
|
||||
await storage.deleteBlob(teamCodeName, newBotPath + '/Trading-Bot/User.Bot.js')
|
||||
|
||||
logger.debug('removeBot completed for bot %s', botCodeName)
|
||||
|
||||
} catch (err) {
|
||||
logger.error('copyBot error for bot %s: %s', botCodeName, err)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import logger from '../utils/logger'
|
||||
import { copyBot } from './CopyBot'
|
||||
import { copySimulator } from './CopySimulator'
|
||||
|
||||
export const copyBots = async (storage, team) => {
|
||||
try {
|
||||
logger.debug('copyBots started for team %s', team.codeName)
|
||||
let bots = []
|
||||
|
||||
let tradingBot = await copyBot(storage, team.codeName, team.bot.codeName, team.bot.displayName)
|
||||
bots.push(tradingBot)
|
||||
|
||||
let simulatorBot = await copySimulator(storage, team.codeName, team.bot.codeName, team.bot.displayName)
|
||||
bots.push(simulatorBot)
|
||||
|
||||
return bots
|
||||
|
||||
} catch (err) {
|
||||
logger.error('copyBots error for teamCodeName: %s, error: %s', team.bot.codeName, err.stack)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import beautify from 'json-beautify'
|
||||
import logger from '../utils/logger'
|
||||
|
||||
export const copySimulator = async (storage, teamCodeName, botCodeName, botDisplayName) => {
|
||||
try {
|
||||
logger.debug('copySimulator started for bot %s', 'simulator-' + botCodeName)
|
||||
|
||||
let containerName = 'aamasters'
|
||||
let templatePath = 'AAMasters/bots/AAJason-Indicator-Bot'
|
||||
let commons = await storage.getFileContent(containerName, templatePath + '/Commons.js')
|
||||
let config = await storage.getFileContent(containerName, templatePath + '/this.bot.config.json')
|
||||
let codeDaily = await storage.getFileContent(containerName, templatePath + '/Multi-Period-Daily/User.Bot.js')
|
||||
let codeMarket = await storage.getFileContent(containerName, templatePath + '/Multi-Period-Market/User.Bot.js')
|
||||
|
||||
// Change config to adapt the new indicator
|
||||
let newBotCodeName = 'simulator-' + botCodeName
|
||||
let parsedConfig = JSON.parse(config)
|
||||
parsedConfig.displayName = 'Simulator ' + botDisplayName
|
||||
parsedConfig.codeName = newBotCodeName
|
||||
parsedConfig.devTeam = teamCodeName
|
||||
parsedConfig.profilePicture = newBotCodeName + '.png'
|
||||
|
||||
parsedConfig.processes[0].statusDependencies[0].devTeam = teamCodeName
|
||||
parsedConfig.processes[0].statusDependencies[0].bot = newBotCodeName
|
||||
parsedConfig.processes[1].statusDependencies[2].devTeam = teamCodeName
|
||||
parsedConfig.processes[1].statusDependencies[2].bot = newBotCodeName
|
||||
|
||||
//Changing Indicator Output
|
||||
parsedConfig.products[0].storageAccount = teamCodeName
|
||||
parsedConfig.products[0].dataSets[0].filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Trading-Simulation/Multi-Period-Market/@Period'
|
||||
parsedConfig.products[0].dataSets[1].filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Trading-Simulation/Multi-Period-Daily/@Period/@Year/@Month/@Day'
|
||||
parsedConfig.products[0].dataSets[1].dataRange.filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Trading-Simulation/Multi-Period-Daily'
|
||||
|
||||
parsedConfig.products[1].storageAccount = teamCodeName
|
||||
parsedConfig.products[1].dataSets[0].filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Simulation-Conditions/Multi-Period-Market/@Period'
|
||||
parsedConfig.products[1].dataSets[1].filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Simulation-Conditions/Multi-Period-Daily/@Period/@Year/@Month/@Day'
|
||||
parsedConfig.products[1].dataSets[1].dataRange.filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Simulation-Conditions/Multi-Period-Daily'
|
||||
|
||||
parsedConfig.products[2].storageAccount = teamCodeName
|
||||
parsedConfig.products[2].dataSets[0].filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Simulation-Strategies/Multi-Period-Market/@Period'
|
||||
parsedConfig.products[2].dataSets[1].filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Simulation-Strategies/Multi-Period-Daily/@Period/@Year/@Month/@Day'
|
||||
parsedConfig.products[2].dataSets[1].dataRange.filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Simulation-Strategies/Multi-Period-Daily'
|
||||
|
||||
parsedConfig.products[3].storageAccount = teamCodeName
|
||||
parsedConfig.products[3].dataSets[0].filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Simulation-Trades/Multi-Period-Market/@Period'
|
||||
parsedConfig.products[3].dataSets[1].filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Simulation-Trades/Multi-Period-Daily/@Period/@Year/@Month/@Day'
|
||||
parsedConfig.products[3].dataSets[1].dataRange.filePath = teamCodeName + '/' + parsedConfig.codeName + '.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Simulation-Trades/Multi-Period-Daily'
|
||||
|
||||
// Write the new files
|
||||
let newSimulatorName = 'simulator-' + newBotCodeName + '-Indicator-Bot'
|
||||
let newSimulatorPath = teamCodeName + '/bots/' + newSimulatorName
|
||||
await storage.writeFileContent(teamCodeName, newSimulatorPath + '/Commons.js', commons)
|
||||
await storage.writeFileContent(teamCodeName, newSimulatorPath + '/this.bot.config.json', beautify(parsedConfig, null, 2, 80))
|
||||
await storage.writeFileContent(teamCodeName, newSimulatorPath + '/Multi-Period-Daily/User.Bot.js', codeDaily)
|
||||
await storage.writeFileContent(teamCodeName, newSimulatorPath + '/Multi-Period-Market/User.Bot.js', codeMarket)
|
||||
|
||||
logger.debug('copySimulator completed for bot %s', newBotCodeName)
|
||||
return parsedConfig
|
||||
} catch (err) {
|
||||
logger.error('copySimulator error for bot: %s. %s', botCodeName, err)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
export const removeSimulator = async (storage, teamCodeName, botCodeName) => {
|
||||
try {
|
||||
logger.debug('removeSimulator started for bot %s', botCodeName)
|
||||
|
||||
// Delete simulator code
|
||||
let newSimulatorName = 'simulator-' + botCodeName + '-Indicator-Bot'
|
||||
let newSimulatorPath = teamCodeName + '/bots/' + newSimulatorName
|
||||
await storage.deleteBlob(teamCodeName, newSimulatorPath + '/Commons.js')
|
||||
await storage.deleteBlob(teamCodeName, newSimulatorPath + '/this.bot.config.json')
|
||||
await storage.deleteBlob(teamCodeName, newSimulatorPath + '/Multi-Period-Daily/User.Bot.js')
|
||||
await storage.deleteBlob(teamCodeName, newSimulatorPath + '/Multi-Period-Market/User.Bot.js')
|
||||
|
||||
logger.debug('removeSimulator completed for bot %s', botCodeName)
|
||||
|
||||
} catch (err) {
|
||||
logger.error('copySimulator error for bot %s: %s', botCodeName, err)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import logger from '../utils/logger'
|
||||
|
||||
export const deleteTeam = async (team) => {
|
||||
try {
|
||||
logger.debug('deleteTeam started for team %s', team.codeName)
|
||||
|
||||
let storage = require ('./providers/AzureStorage') // Default value
|
||||
if (process.env.STORAGE_PROVIDER === 'Minio') {
|
||||
storage = require ('./providers/MinioStorage')
|
||||
}
|
||||
|
||||
await storage.deleteContainer(team.codeName)
|
||||
|
||||
} catch (err) {
|
||||
logger.error('deleteTeam error for teamCodeName: %s, error: %s', team.codeName, err.stack)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
import logger from '../../utils/logger'
|
||||
import {
|
||||
Aborter,
|
||||
BlobURL,
|
||||
BlockBlobURL,
|
||||
ContainerURL,
|
||||
ServiceURL,
|
||||
StorageURL,
|
||||
SharedKeyCredential,
|
||||
AnonymousCredential
|
||||
} from '@azure/storage-blob'
|
||||
|
||||
const AzureServiceURL = () => {
|
||||
// Use SharedKeyCredential with storage account and account key
|
||||
const sharedKeyCredential = new SharedKeyCredential(process.env.STORAGE_BASE_URL, process.env.STORAGE_CONNECTION_STRING);
|
||||
|
||||
// Use sharedKeyCredential, tokenCredential or anonymousCredential to create a pipeline
|
||||
const pipeline = StorageURL.newPipeline(sharedKeyCredential, {
|
||||
retryOptions: { maxTries: 10 }
|
||||
});
|
||||
|
||||
// List containers
|
||||
const serviceURL = new ServiceURL(
|
||||
// When using AnonymousCredential, following url should include a valid SAS or support public access
|
||||
`https://${process.env.STORAGE_BASE_URL}.blob.core.windows.net`,
|
||||
pipeline
|
||||
)
|
||||
return serviceURL
|
||||
}
|
||||
|
||||
const serviceURL = AzureServiceURL()
|
||||
|
||||
export const getFileContentRemote = async (containerName, blobName, storage, accessKey) => {
|
||||
const pipeline = StorageURL.newPipeline(new AnonymousCredential(), {
|
||||
retryOptions: { maxTries: 10 }
|
||||
});
|
||||
const serviceURLWithAccessKey = new ServiceURL(
|
||||
`${storage}${accessKey}`,
|
||||
pipeline
|
||||
);
|
||||
const containerURL = ContainerURL.fromServiceURL(serviceURLWithAccessKey, containerName)
|
||||
const blockBlobURL = BlockBlobURL.fromContainerURL(containerURL, blobName)
|
||||
let downloadResponse = await blockBlobURL.download(Aborter.none, 0)
|
||||
return await streamToString(downloadResponse.readableStreamBody)
|
||||
}
|
||||
|
||||
export const getFileContent = async (containerName, blobName) => {
|
||||
const containerURL = ContainerURL.fromServiceURL(serviceURL, containerName)
|
||||
const blockBlobURL = BlockBlobURL.fromContainerURL(containerURL, blobName)
|
||||
let downloadResponse = await blockBlobURL.download(Aborter.none, 0)
|
||||
return await streamToString(downloadResponse.readableStreamBody)
|
||||
}
|
||||
|
||||
export const writeFileContent = async (containerName, blobName, content) => {
|
||||
const containerURL = ContainerURL.fromServiceURL(serviceURL, containerName)
|
||||
const blobURL = BlobURL.fromContainerURL(containerURL, blobName)
|
||||
const blockBlobURL = BlockBlobURL.fromBlobURL(blobURL)
|
||||
await blockBlobURL.upload(
|
||||
Aborter.none,
|
||||
content,
|
||||
content.length
|
||||
)
|
||||
}
|
||||
|
||||
export const deleteBlob = async (containerName, blobName) => {
|
||||
try {
|
||||
const containerURL = ContainerURL.fromServiceURL(serviceURL, containerName)
|
||||
const blockBlobURL = BlockBlobURL.fromContainerURL(containerURL, blobName)
|
||||
await blockBlobURL.delete(Aborter.none)
|
||||
} catch (err) {
|
||||
logger.warn('Error deleting the file: %s%s', containerName, blobName)
|
||||
}
|
||||
}
|
||||
|
||||
export const deleteContainer = async (containerName) => {
|
||||
const containerURL = ContainerURL.fromServiceURL(serviceURL, containerName)
|
||||
await containerURL.delete(Aborter.none)
|
||||
logger.debug('deleteContainer -> Successful.')
|
||||
}
|
||||
|
||||
export const createContainer = async (containerName) => {
|
||||
const containerURL = ContainerURL.fromServiceURL(serviceURL, containerName)
|
||||
await containerURL.create(Aborter.none)
|
||||
logger.debug('createContainer -> Successful.')
|
||||
}
|
||||
|
||||
// A helper method used to read a Node.js readable stream into string
|
||||
async function streamToString(readableStream) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const chunks = [];
|
||||
readableStream.on('data', data => {
|
||||
chunks.push(data.toString());
|
||||
});
|
||||
readableStream.on('end', () => {
|
||||
resolve(chunks.join(''));
|
||||
});
|
||||
readableStream.on('error', reject)
|
||||
});
|
||||
}
|
||||
|
||||
export const createPrivateAccessKey = (container, type, days) => {
|
||||
let azure = require('azure-storage');
|
||||
let blobService = azure.createBlobService(process.env.AZURE_STORAGE_CONNECTION_STRING);
|
||||
|
||||
let startDate = new Date();
|
||||
startDate.setDate(startDate.getDate() - 1);
|
||||
|
||||
let expiryDate = new Date(startDate);
|
||||
expiryDate.setDate(startDate.getDate() + days);
|
||||
|
||||
let azurePermissions;
|
||||
|
||||
switch (type) {
|
||||
case 'READ': {
|
||||
azurePermissions = azure.BlobUtilities.SharedAccessPermissions.READ;
|
||||
break;
|
||||
}
|
||||
case 'WRITE': {
|
||||
azurePermissions = azure.BlobUtilities.SharedAccessPermissions.WRITE;
|
||||
break;
|
||||
}
|
||||
case 'DELETE': {
|
||||
azurePermissions = azure.BlobUtilities.SharedAccessPermissions.DELETE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let blobName = undefined;
|
||||
|
||||
let sharedAccessPolicy = {
|
||||
AccessPolicy: {
|
||||
Permissions: azurePermissions,
|
||||
Start: startDate,
|
||||
Expiry: expiryDate
|
||||
}
|
||||
};
|
||||
|
||||
return blobService.generateSharedAccessSignature(container, blobName, sharedAccessPolicy);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { createLogger, format, transports } from 'winston'
|
||||
import { inspect } from 'util'
|
||||
|
||||
const options = {
|
||||
file: {
|
||||
level: 'info',
|
||||
filename: '../logs/app.log',
|
||||
handleExceptions: true,
|
||||
json: true,
|
||||
maxsize: 5242880, // 5MB
|
||||
maxFiles: 5,
|
||||
colorize: false,
|
||||
timestamp: true
|
||||
},
|
||||
console: {
|
||||
level: process.env.LOG_LEVEL || 'debug',
|
||||
handleExceptions: true,
|
||||
json: false,
|
||||
colorize: true,
|
||||
timestamp: true
|
||||
}
|
||||
}
|
||||
|
||||
const logger = createLogger({
|
||||
level: 'info',
|
||||
format: format.combine(
|
||||
format.colorize(),
|
||||
format.splat(),
|
||||
format.timestamp({ format: 'YY/MM/DD HH:mm' }),
|
||||
format.printf(
|
||||
info => `${info.timestamp} - ${info.level}: ${JSON.parse(JSON.stringify(inspect(info.message)))}`
|
||||
)
|
||||
),
|
||||
transports: [
|
||||
// new transports.File(options.file),
|
||||
new transports.Console(options.console)
|
||||
],
|
||||
exitOnError: false // do not exit on handled exceptions
|
||||
})
|
||||
|
||||
export default logger
|
||||
Reference in new issue
Block a user