Merge pull request #2 from AAVikings/develop

Release candidate
This commit is contained in:
z@tOr authored and GitHub committed 2019-01-29 18:33:09 -03:00
commit efe1b2b50e
53 files changed
+1096 -809

No files matched your search

View File
Whitespace-only changes.
-46
View File
@@ -1,46 +0,0 @@
# 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 at feedback at advancedalgos dot org. 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/
-45
View File
@@ -1,45 +0,0 @@
# 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!
Advanced Algos LTD is a startup, currently at a very early stage. Although this repository is not open source software yet, we do welcome contributions from the community.
Contributions are deemed _voluntary work_. There might be incentives in place for certain kinds of contributions. Contact us for more information in this regards.
In any case, contributors agree to provide an express grant of patent rights for their contributions. Submitting Pull Requests to this repository represents an express agreement with the terms of our Balanced Contributor Intellectual Property Agreement. This agreement is a direct implementation of GitHub's [Balanced Employee Intellectual Property Agreement 1.0.1](https://github.com/github/balanced-employee-ip-agreement/blob/master/Balanced_Employee_IP_Agreement.md).
# Balanced Contributor Intellectual Property Agreement 1.0.1
This BALANCED CONTRIBUTOR INTELLECTUAL PROPERTY AGREEMENT is between person or team submitting Pull Requests to this repository and Advanced Algos LTD ("Company").
**What is this?** This is the Company's Intellectual Property Agreement ("Agreement"). If you've worked in the technology space before, there's a good chance that you've run across one or more of these in the past. This document is the official, entire and exclusive agreement on what intellectual property ("IP") is yours, and what belongs to the Company.
**Why is this?** The Company needs to be clear on what IP it owns and has rights to. Its customers, contributors, and investors depend on the Company having the legal rights to the products and services it is providing so that the Company can continue operating and doing business.
The Company also believes that it's important to be clear on what it doesn't own. The Company doesn't want you looking over your shoulder every time you work on something personal or worrying that the Company will someday seize your open source non-lethal mousetrap simulation software. In other words, the Company isn't interested in appropriating your personal projects.
**Read this.** Please read this document and be sure you understand it before you submit any Pull Requests. Due to legal risk and corporate obligations, the Company cannot, by and large, negotiate its terms. If you feel you have a particular circumstance that keeps you from signing, please let the Company's legal department ("Legal") know. And, of course, you're always free and encouraged to get your own legal counsel to explain anything you're not clear on.
Cool? Then, by submitting your first Pull Request, and as a condition of your contribution, you agree to the following:
1. **What the Company owns.** The Company owns any IP ("Company IP") that you create, or help create _as its contributor_, but only if it meets one or more of these additional conditions: The IP was (i) related to an existing or prospective Company product or service at the time you developed, invented, or created it, (ii) developed for use by the Company, or (iii) developed or promoted with existing Company IP or with the Company's endorsement. You hereby grant and assign, and will grant and assign, to the Company all rights and interests in all Company IP.
"Company IP" includes concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, and works of authorship.
2. **What the Company doesn't own.** If you create IP that doesn't fit into one of the categories listed above, the Company doesn't own it. In other words, the Company doesn't own concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, or works of authorship that you develop, invent, or create that do not meet any of the conditions in Section 1.
3. **Contribution of your IP to Company projects.** If you include your own IP – such as IP you created prior to working for the Company – into a Company product or service, it's still yours, of course, but you grant the Company a non-exclusive, irrevocable, fully paid-up, royalty-free, perpetual, sublicensable, transferable, worldwide license to use it without restriction in any way or implementation, in modified form, or as is, by itself, or incorporated into another product or service ("License"). If you include your name in any project over which the Company would have rights under this Agreement, such as in a copyright notice or a comment in code or documentation, then the License covers the rights associated with that use of your name as well.
4. **Your contributions to non-Company projects.** The Company recognizes that you may be engaged in work that requires you to submit IP to entities other than the Company, such as open source projects used by the Company. Please make sure that Legal is aware of what you're working on so that Legal can help with any licensing issues. If any project asks you to sign a contribution agreement, you should check with Legal before doing so. These agreements may be legally binding on the Company and so should be run through Legal first.
5. **Voluntary Works** All Company IP that you are involved with or create as part of your work for the Company is voluntary work which does not require compensation. There might be incentives in place for certain kinds of contributions. Feel free to contact the Company to learn more.
6. **No conflicts.** You agree that you don't have any outstanding agreements or obligations that conflict with those in this Agreement, and that you won't enter into conflicting agreements in the future.
7. **IP protection.** The Company might someday need to show the work that went into the development of IP that it uses or has used, or to make government filings to establish that it owns the IP or has rights over it. To help in those situations, you agree not to destroy any records you maintain relating to the development of any Company IP or IP under License (together, "All IP"), and, if the Company asks, to provide those records to the Company. You agree to help the Company secure and defend its rights in All IP. For your help the Company will compensate you at a reasonable rate. If the Company is unable to secure your help, you authorize the Company to act on your behalf (as your agent and attorney-in-fact) in securing all rights related to All IP.
8. **Confidentiality.** As an contributor or contractor of the Company, you will have access to sensitive confidential information that is important to the Company's business. You are responsible for keeping this information confidential, including after you end your work for the Company.
"Confidential Information" includes non-public technical details about our products or services, financial information, business strategies and forecasts, customer data, or any other information, data or know-how that is valuable to the Company because it is not publicly known.
The Company's Confidential Information is sensitive and we expect that you'll treat it as such. You agree to only use the Company's Confidential Information for the purpose of performing your contribution and for the benefit of the Company. You will do your best to keep Confidential Information secret. If you are not sure if something is Confidential Information, you should assume that it is, until you can confirm otherwise.
-42
View File
@@ -1,42 +0,0 @@
COPYRIGHT NOTICE
© Copyright 2018 Advanced Algos LTD.
LICENSE NOTICE
Advanced Algos LTD. is a startup, currently at a very early stage. Because certain aspects of
the business are still not clearly defined, we have chosen to --temporarily-- grant a
restrictive license for the use of this repository, until those business aspects are clarified
and a proper open source license can be granted.
Advanced Algos LTD. is publishing the code of this software for several reasons. However,
it shall not be considered free software yet. Advanced Algos LTD. is a for-profit company
in the crypto space and this module is still proprietary software.
The reasons for opening up the code of this module at this stage are the following:
* We believe that transparency is paramount to achieving our goals, so we want everyone
to be able to understand what this module does and how. Opening up the code of this module
allows anyone to take a close look.
* We welcome contributions from the community. Contributions are regarded as voluntary work.
There may be incentives in place for certain kinds of contributions. Contact us to learn more.
Contributors agree to provide an express grant of patent rights for their contributions.
LICENSE WORDING
Advanced Algos LTD. grants a limited license for the following uses:
1. CODE REVIEW AND AUDITS. You are granted permission to clone this repository to analyze,
review or audit the code.
2. COLLABORATING WITH ADVANCED ALGOS LTD. You are granted permission to fork this repository
with the sole purpose of correcting bugs and developing functionality in agreement with
Advanced Algos LTD. By contributing to this repository you explicitely agree to the terms
detailed in CONTRIBUTING.MD.
PLEASE SEE CONTRIBUTING.MD FOR MORE DETAILS ON THE IMPLICATIONS SURROUNDING YOUR CONTRIBUTIONS TO THIS REPOSITORY.
+1 -1
View File
@@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at feedback at advancedalgos dot org. 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.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at feedback at superalgos dot org. 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.
+17 -17
View File
@@ -2,44 +2,44 @@
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!
Advanced Algos LTD is a startup, currently at a very early stage. Although this repository is not open source software yet, we do welcome contributions from the community.
Superalgos is a collective project, currently at a very early stage. Although this repository is not open source software yet, we do welcome contributions from the community.
Contributions are deemed _voluntary work_. There might be incentives in place for certain kinds of contributions. Contact us for more information in this regards.
Contributions are deemed _voluntary work_. There might be incentives in place for certain kinds of contributions. Contact us for more information in this regard.
In any case, contributors agree to provide an express grant of patent rights for their contributions. Submitting Pull Requests to this repository represents an express agreement with the terms of our Balanced Contributor Intellectual Property Agreement. This agreement is a direct implementation of GitHub's [Balanced Employee Intellectual Property Agreement 1.0.1](https://github.com/github/balanced-employee-ip-agreement/blob/master/Balanced_Employee_IP_Agreement.md).
# Balanced Contributor Intellectual Property Agreement 1.0.1
This BALANCED CONTRIBUTOR INTELLECTUAL PROPERTY AGREEMENT is between person or team submitting Pull Requests to this repository and Advanced Algos LTD ("Company").
This BALANCED CONTRIBUTOR INTELLECTUAL PROPERTY AGREEMENT is between person or team submitting Pull Requests to this repository and Superalgos.org ("Project").
**What is this?** This is the Company's Intellectual Property Agreement ("Agreement"). If you've worked in the technology space before, there's a good chance that you've run across one or more of these in the past. This document is the official, entire and exclusive agreement on what intellectual property ("IP") is yours, and what belongs to the Company.
**What is this?** This is the Project's Intellectual Property Agreement ("Agreement"). If you've worked in the technology space before, there's a good chance that you've run across one or more of these in the past. This document is the official, entire and exclusive agreement on what intellectual property ("IP") is yours, and what belongs to the Project.
**Why is this?** The Company needs to be clear on what IP it owns and has rights to. Its customers, contributors, and investors depend on the Company having the legal rights to the products and services it is providing so that the Company can continue operating and doing business.
**Why is this?** The Project needs to be clear on what IP it owns and has rights to. Its customers, contributors, and investors depend on the Project having the legal rights to the products and services it is providing so that the Project can continue operating and doing business.
The Company also believes that it's important to be clear on what it doesn't own. The Company doesn't want you looking over your shoulder every time you work on something personal or worrying that the Company will someday seize your open source non-lethal mousetrap simulation software. In other words, the Company isn't interested in appropriating your personal projects.
The Project also believes that it's important to be clear on what it doesn't own. The Project doesn't want you looking over your shoulder every time you work on something personal or worrying that the Project will someday seize your open source non-lethal mousetrap simulation software. In other words, the Project isn't interested in appropriating your personal projects.
**Read this.** Please read this document and be sure you understand it before you submit any Pull Requests. Due to legal risk and corporate obligations, the Company cannot, by and large, negotiate its terms. If you feel you have a particular circumstance that keeps you from signing, please let the Company's legal department ("Legal") know. And, of course, you're always free and encouraged to get your own legal counsel to explain anything you're not clear on.
**Read this.** Please read this document and be sure you understand it before you submit any Pull Requests. Due to legal risk and corporate obligations, the Project cannot, by and large, negotiate its terms. If you feel you have a particular circumstance that keeps you from signing, please let the Project's legal department ("Legal") know. And, of course, you're always free and encouraged to get your own legal counsel to explain anything you're not clear on.
Cool? Then, by submitting your first Pull Request, and as a condition of your contribution, you agree to the following:
1. **What the Company owns.** The Company owns any IP ("Company IP") that you create, or help create _as its contributor_, but only if it meets one or more of these additional conditions: The IP was (i) related to an existing or prospective Company product or service at the time you developed, invented, or created it, (ii) developed for use by the Company, or (iii) developed or promoted with existing Company IP or with the Company's endorsement. You hereby grant and assign, and will grant and assign, to the Company all rights and interests in all Company IP.
1. **What the Project owns.** The Project owns any IP ("Project IP") that you create, or help create _as its contributor_, but only if it meets one or more of these additional conditions: The IP was (i) related to an existing or prospective Project product or service at the time you developed, invented, or created it, (ii) developed for use by the Project, or (iii) developed or promoted with existing Project IP or with the Project's endorsement. You hereby grant and assign, and will grant and assign, to the Project all rights and interests in all Project IP.
"Company IP" includes concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, and works of authorship.
"Project IP" includes concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, and works of authorship.
2. **What the Company doesn't own.** If you create IP that doesn't fit into one of the categories listed above, the Company doesn't own it. In other words, the Company doesn't own concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, or works of authorship that you develop, invent, or create that do not meet any of the conditions in Section 1.
2. **What the Project doesn't own.** If you create IP that doesn't fit into one of the categories listed above, the Project doesn't own it. In other words, the Project doesn't own concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, or works of authorship that you develop, invent, or create that do not meet any of the conditions in Section 1.
3. **Contribution of your IP to Company projects.** If you include your own IP – such as IP you created prior to working for the Company – into a Company product or service, it's still yours, of course, but you grant the Company a non-exclusive, irrevocable, fully paid-up, royalty-free, perpetual, sublicensable, transferable, worldwide license to use it without restriction in any way or implementation, in modified form, or as is, by itself, or incorporated into another product or service ("License"). If you include your name in any project over which the Company would have rights under this Agreement, such as in a copyright notice or a comment in code or documentation, then the License covers the rights associated with that use of your name as well.
3. **Contribution of your IP to Project projects.** If you include your own IP – such as IP you created prior to working for the Project – into a Project product or service, it's still yours, of course, but you grant the Project a non-exclusive, irrevocable, fully paid-up, royalty-free, perpetual, sublicensable, transferable, worldwide license to use it without restriction in any way or implementation, in modified form, or as is, by itself, or incorporated into another product or service ("License"). If you include your name in any project over which the Project would have rights under this Agreement, such as in a copyright notice or a comment in code or documentation, then the License covers the rights associated with that use of your name as well.
4. **Your contributions to non-Company projects.** The Company recognizes that you may be engaged in work that requires you to submit IP to entities other than the Company, such as open source projects used by the Company. Please make sure that Legal is aware of what you're working on so that Legal can help with any licensing issues. If any project asks you to sign a contribution agreement, you should check with Legal before doing so. These agreements may be legally binding on the Company and so should be run through Legal first.
4. **Your contributions to non-Project projects.** The Project recognizes that you may be engaged in work that requires you to submit IP to entities other than the Project, such as open source projects used by the Project. Please make sure that Legal is aware of what you're working on so that Legal can help with any licensing issues. If any project asks you to sign a contribution agreement, you should check with Legal before doing so. These agreements may be legally binding on the Project and so should be run through Legal first.
5. **Voluntary Works** All Company IP that you are involved with or create as part of your work for the Company is voluntary work which does not require compensation. There might be incentives in place for certain kinds of contributions. Feel free to contact the Company to learn more.
5. **Voluntary Works** All Project IP that you are involved with or create as part of your work for the Project is voluntary work which does not require compensation. There might be incentives in place for certain kinds of contributions. Feel free to contact the Project to learn more.
6. **No conflicts.** You agree that you don't have any outstanding agreements or obligations that conflict with those in this Agreement, and that you won't enter into conflicting agreements in the future.
7. **IP protection.** The Company might someday need to show the work that went into the development of IP that it uses or has used, or to make government filings to establish that it owns the IP or has rights over it. To help in those situations, you agree not to destroy any records you maintain relating to the development of any Company IP or IP under License (together, "All IP"), and, if the Company asks, to provide those records to the Company. You agree to help the Company secure and defend its rights in All IP. For your help the Company will compensate you at a reasonable rate. If the Company is unable to secure your help, you authorize the Company to act on your behalf (as your agent and attorney-in-fact) in securing all rights related to All IP.
7. **IP protection.** The Project might someday need to show the work that went into the development of IP that it uses or has used, or to make government filings to establish that it owns the IP or has rights over it. To help in those situations, you agree not to destroy any records you maintain relating to the development of any Project IP or IP under License (together, "All IP"), and, if the Project asks, to provide those records to the Project. You agree to help the Project secure and defend its rights in All IP. For your help the Project will compensate you at a reasonable rate. If the Project is unable to secure your help, you authorize the Project to act on your behalf (as your agent and attorney-in-fact) in securing all rights related to All IP.
8. **Confidentiality.** As an contributor or contractor of the Company, you will have access to sensitive confidential information that is important to the Company's business. You are responsible for keeping this information confidential, including after you end your work for the Company.
8. **Confidentiality.** As an contributor or contractor of the Project, you will have access to sensitive confidential information that is important to the Project's business. You are responsible for keeping this information confidential, including after you end your work for the Project.
"Confidential Information" includes non-public technical details about our products or services, financial information, business strategies and forecasts, customer data, or any other information, data or know-how that is valuable to the Company because it is not publicly known.
"Confidential Information" includes non-public technical details about our products or services, financial information, business strategies and forecasts, customer data, or any other information, data or know-how that is valuable to the Project because it is not publicly known.
The Company's Confidential Information is sensitive and we expect that you'll treat it as such. You agree to only use the Company's Confidential Information for the purpose of performing your contribution and for the benefit of the Company. You will do your best to keep Confidential Information secret. If you are not sure if something is Confidential Information, you should assume that it is, until you can confirm otherwise.
The Project's Confidential Information is sensitive and we expect that you'll treat it as such. You agree to only use the Project's Confidential Information for the purpose of performing your contribution and for the benefit of the Project. You will do your best to keep Confidential Information secret. If you are not sure if something is Confidential Information, you should assume that it is, until you can confirm otherwise.
+14 -17
View File
@@ -1,23 +1,22 @@
COPYRIGHT NOTICE
© Copyright 2018 Advanced Algos LTD.
© Copyright 2018 Superalgos.org
LICENSE NOTICE
Advanced Algos LTD. is a startup, currently at a very early stage. Because certain aspects of
the business are still not clearly defined, we have chosen to --temporarily-- grant a
restrictive license for the use of this repository, until those business aspects are clarified
and a proper open source license can be granted.
Superalgos is a collaborative project currently at a very early stage. Because certain aspects of
the project are still not clearly defined, we have chosen to --temporarily-- grant a restrictive
license for the use of this repository, until those aspects are clarified and a proper open source
license can be granted.
Advanced Algos LTD. is publishing the code of this software for several reasons. However,
it shall not be considered free software yet. Advanced Algos LTD. is a for-profit company
in the crypto space and this module is still proprietary software.
Superalgos.org is publishing the code of this software for several reasons. However, it shall not be considered free software yet. Superalgos is a collaborative project in the crypto space and this
software is still proprietary software.
The reasons for opening up the code of this module at this stage are the following:
The reasons for opening up the code of this software at this stage are the following:
* We believe that transparency is paramount to achieving our goals, so we want everyone
to be able to understand what this module does and how. Opening up the code of this module
* We believe that transparency is paramount to achieving our goals, so we want everyone to
be able to understand what this software does and how. Opening up the code of this software
allows anyone to take a close look.
* We welcome contributions from the community. Contributions are regarded as voluntary work.
@@ -27,16 +26,14 @@ The reasons for opening up the code of this module at this stage are the followi
LICENSE WORDING
Advanced Algos LTD. grants a limited license for the following uses:
Superalgos.org grants a limited license for the following uses:
1. CODE REVIEW AND AUDITS. You are granted permission to clone this repository to analyze,
review or audit the code.
2. COLLABORATING WITH ADVANCED ALGOS LTD. You are granted permission to fork this repository
2. COLLABORATING WITH Superalgos.org. You are granted permission to fork this repository
with the sole purpose of correcting bugs and developing functionality in agreement with
Advanced Algos LTD. By contributing to this repository you explicitely agree to the terms
Superalgos.org. By contributing to this repository you explicitely agree to the terms
detailed in CONTRIBUTING.MD.
PLEASE SEE CONTRIBUTING.MD FOR MORE DETAILS ON THE IMPLICATIONS SURROUNDING YOUR CONTRIBUTIONS TO THIS REPOSITORY.
PLEASE SEE CONTRIBUTING.MD FOR MORE DETAILS ON THE IMPLICATIONS SURROUNDING YOUR CONTRIBUTIONS TO THIS REPOSITORY.
+10 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@advancedalgos/operations-client",
"version": "0.0.1",
"name": "@superalgos/operations-client",
"version": "0.0.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -689,6 +689,14 @@
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
},
"react-number-format": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/react-number-format/-/react-number-format-4.0.6.tgz",
"integrity": "sha512-WfBlqYRD0fGZpQxRy1apxsPeaqtxhzo7CnUVFKBoGDsQbc89+DQNhjG/D3IxgGYM47oKB+W/Su9ol/vVS6Wc2Q==",
"requires": {
"prop-types": "15.6.2"
}
},
"react-router": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-4.3.1.tgz",
+4 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@advancedalgos/operations-client",
"version": "0.0.1",
"description": "Advanced Algos Operations client-side web app",
"name": "@superalgos/operations-client",
"version": "0.0.2",
"description": "Superalgos Operations client-side web app",
"main": "src/index.js",
"dependencies": {
"@material-ui/core": "^3.2.2",
@@ -15,6 +15,7 @@
"react": "^16.6.1",
"react-apollo": "^2.2.4",
"react-dom": "^16.6.1",
"react-number-format": "^4.0.6",
"react-router-dom": "^4.3.1"
},
"devDependencies": {
+10
View File
@@ -19,6 +19,15 @@ const OPERATIONS_LIST_CLONES = gql`
${clone}
`;
const OPERATIONS_HISTORY_CLONES = gql`
query Operations_HistoryClones{
operations_HistoryClones {
...clone
}
}
${clone}
`;
const OPERATIONS_REMOVE_CLONE = gql`
mutation Operations_RemoveClone($id: ID!){
operations_RemoveClone( id: $id)
@@ -27,6 +36,7 @@ const OPERATIONS_REMOVE_CLONE = gql`
export default {
OPERATIONS_LIST_CLONES,
OPERATIONS_HISTORY_CLONES,
OPERATIONS_ADD_CLONE,
OPERATIONS_REMOVE_CLONE
};
+2 -19
View File
@@ -10,29 +10,12 @@ export const GET_ALL_TEAMS_QUERY = gql`
id
name
slug
}
}
}
`
export const GET_ALL_TEAM_BOTS_QUERY = gql`
query teamBotsQuery($teamId: String!) {
teams_TeamById(teamId: $teamId) {
fb {
id
name
slug
team{
id
name
slug
}
kind
}
}
}
`
export default {
GET_ALL_TEAMS_QUERY,
GET_ALL_TEAM_BOTS_QUERY
GET_ALL_TEAMS_QUERY
};
+13
View File
@@ -16,5 +16,18 @@ export const clone = gql`
createDatetime
lastLogs
runAsTeam
summaryDate
buyAverage
sellAverage
marketRate
combinedProfitsA
combinedProfitsB
assetA
assetB
kind
teamName
botName
botAvatar
teamAvatar
}
`;
+2 -1
View File
@@ -1,4 +1,5 @@
import { clone } from './clone';
import { clone } from './clone'
export {
clone
-55
View File
@@ -1,56 +1 @@
import gql from 'graphql-tag'
const getSecret = gql`
query($id: ID!){
keyVault_Secret(id: $id)
}
`
const editCloneMutation = gql`
mutation($id: ID!, $type: String!, $description: String!, $validFrom: Int!,
$validTo: Int!, $active: Boolean!, $botId: ID!){
operations_EditClone(
id: $id,
type: $type,
description: $description,
validFrom: $validFrom,
validTo: $validTo,
active: $active,
botId: $botId
){
id
key
}
}
`
const getCloneQuery = gql`
query($id: ID!){
opeations_Clone(id: $id) {
id
authId
key
type
description
exchange
validFrom
validTo
active
botId
}
}
`
const getAuditLog = gql`
query($key: String!){
keyVault_AuditLogs(key: $key){
id,
date,
action,
details
}
}
`
export { getSecret, editCloneMutation,
getCloneQuery, getAuditLog }
+6 -1
View File
@@ -1,4 +1,7 @@
const types = [ 'Live', 'Competition', 'Backtest' ]
const startModes = [ 'All Months', 'One Month', 'No Time' ]
const availableMonths = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"]
const exchanges = [
{
@@ -7,4 +10,6 @@ const exchanges = [
}
]
export { types, exchanges }
export { types, exchanges, startModes, availableMonths }
+2
View File
@@ -5,6 +5,7 @@ import { MuiPickersUtilsProvider } from 'material-ui-pickers'
import LuxonUtils from 'material-ui-pickers/utils/luxon-utils'
import BrowseClones from './views/Clone/List'
import HistoryClones from './views/Clone/History'
import AddClone from './views/Clone/Add'
import Home from './views/Home'
@@ -13,6 +14,7 @@ const App = () => (
<Switch>
<Route exact path='/operations/' component={Home} />
<Route path='/operations/browse' component={BrowseClones} />
<Route path='/operations/history' component={HistoryClones} />
<Route path='/operations/add' component={AddClone} />
</Switch>
</MuiPickersUtilsProvider>
+9
View File
@@ -72,3 +72,12 @@ export function slugify (string) {
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, '') // Trim - from end of text
}
export function getIndicatorYears () {
const localDate = new Date()
let availableYears = []
for (var i = 2015; i <= localDate.getUTCFullYear(); i++) {
availableYears[i-2015] = i
}
return availableYears
}
+284 -129
View File
@@ -9,20 +9,22 @@ import { withStyles } from '@material-ui/core/styles'
import classNames from 'classnames'
import styles from './styles'
import { types} from '../../../GraphQL/models'
import { isDefined } from '../../../utils'
import { types, startModes, availableMonths, processNames } from '../../../GraphQL/models'
import { isDefined, getIndicatorYears } from '../../../utils'
import {
MenuItem, Button, TextField, FormControl, InputLabel, Input, Typography,
Paper, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions,
Select, FormControlLabel, Checkbox
Select, FormControlLabel, Checkbox, FormHelperText
} from '@material-ui/core'
import { DateTimePicker } from 'material-ui-pickers';
import NumberFormat from 'react-number-format'
import { DateTimePicker } from 'material-ui-pickers'
import {
ChevronLeft,
ChevronRight,
} from '@material-ui/icons';
} from '@material-ui/icons'
class AddClone extends Component {
@@ -31,17 +33,23 @@ class AddClone extends Component {
let user = localStorage.getItem('user')
this.state = {
user: JSON.parse(user),
teamId:'',
botId:'',
mode:'',
selectedBot: {'id':''},
mode: '',
resumeExecution: false,
beginDatetime: DateTime.local().minus({ days: 8 }).startOf('day'),
endDatetime: DateTime.local(),
waitTime: 1,
state : '',
state: '',
stateDatetime: 0,
createDatetime: 0,
runAsTeam: false,
financialBeings:[],
// Indicator Bot
startYear: 2019,
endYear: 2019,
month: 1,
processName: '',
//Error handlers
nameError: false,
@@ -49,8 +57,9 @@ class AddClone extends Component {
botError: false,
modeError: false,
isNewCloneConfirmationOpen: false,
serverResponse:'',
serverError: false
serverResponse: '',
serverError: false,
processNameError: false
}
}
@@ -62,7 +71,7 @@ class AddClone extends Component {
size='big'
title='Create a bot clone'
text="Please login to create a bot clone."
backgroundUrl='https://advancedalgos.net/img/photos/ecosystem.jpg'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
} else return (
@@ -71,7 +80,7 @@ class AddClone extends Component {
size='medium'
title='Create a bot clone'
text='Create a bot clone here.'
backgroundUrl='https://advancedalgos.net/img/photos/ecosystem.jpg'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
<div className='container'>
@@ -84,8 +93,7 @@ class AddClone extends Component {
<Typography className={classes.typography} variant='subtitle1' align='justify'>
A bot clone it's a copy of your bot running on a virtual machine.
At the moment Live clones trade by default 0.001 BTC on Poloniex.
Please select the team and bot you want to clone!
Please select from your teams and bots the one you want to clone!
</Typography>
<FormControl className={classNames(classes.form, classes.textField)} fullWidth>
@@ -94,6 +102,8 @@ class AddClone extends Component {
</InputLabel>
<Query query={teams.GET_ALL_TEAMS_QUERY} >
{({ loading, error, data }) => {
if (error) return `Error! There has been an error loading teams.`
if (loading) {
return (
<Select
@@ -106,7 +116,9 @@ class AddClone extends Component {
<MenuItem key='1' value='loading'>Loading...</MenuItem>
</Select>
)
} else if(!isDefined(data.teams_FbByTeamMember)){
}
if(!isDefined(data.teams_FbByTeamMember)){
return (
<Select
value='noteams'
@@ -118,121 +130,241 @@ class AddClone extends Component {
<MenuItem key='1' value='noteams'>You don't have any teams yet.</MenuItem>
</Select>
)
} else if (error) return `Error! There has been an error loading teams.`
} else{
this.financialBeings = data.teams_FbByTeamMember.fb
}
return (
<Select
value={this.state.teamId}
input={<Input />}
className={classes.selectEmpty}
onBlur={(e)=>this.setState({teamError:false})}
error={this.state.teamError}
onChange={e => this.setState({teamId:e.target.value})}
>
<MenuItem key={data.teams_FbByTeamMember.id}
value={data.teams_FbByTeamMember.id}>
{data.teams_FbByTeamMember.name + '/' + data.teams_FbByTeamMember.fb[0].name}
</MenuItem>
</Select>
<Select
value={this.state.selectedBot.id}
displayEmpty
className={classes.selectEmpty}
onBlur={(e)=>this.setState({botError:false})}
error={this.state.botError}
onChange={e => this.setSelectedBot(e.target.value)}
>
{
data.teams_FbByTeamMember.fb.map(financialBeing => (
<MenuItem key={financialBeing.id} value={financialBeing.id}>
{data.teams_FbByTeamMember.name + '/' + financialBeing.name}
</MenuItem>
))
}
</Select>
)
}}
</Query>
<FormHelperText>{this.state.selectedBot.kind}</FormHelperText>
</FormControl>
<TextField
select
label="Running Mode"
className={classNames(classes.margin, classes.textField, classes.form)}
value={this.state.mode}
onChange={(e)=> this.setState({mode:e.target.value})}
onBlur={(e)=>this.setState({modeError:false})}
error={this.state.modeError}
fullWidth
>
{types.map(option => (
<MenuItem key={option} value={option}>
{option}
</MenuItem>
))}
</TextField>
{ /* TRADER BOT */ }
{ this.state.selectedBot.kind === "TRADER" &&
<React.Fragment>
<Typography className={classes.typography} variant='subtitle1' align='justify'>
At the moment Live Trading Clones trade by default 0.001 BTC on Poloniex.
</Typography>
{ this.state.mode == "Backtest" &&
<React.Fragment>
<DateTimePicker
autoOk
disableFuture
format="DD' at 'HH:mm"
ampm={false}
showTabs={false}
leftArrowIcon={<ChevronLeft />}
rightArrowIcon={<ChevronRight />}
value={this.state.beginDatetime}
label='Backtest Start Date'
onChange={newVal => this.setState({ beginDatetime: newVal })}
className={classNames(classes.form, classes.textField)}
fullWidth
/>
<TextField
select
label="Running Mode"
className={classNames(classes.margin, classes.textField, classes.form)}
value={this.state.mode}
onChange={(e)=> this.setState({mode:e.target.value})}
onBlur={(e)=>this.setState({modeError:false})}
error={this.state.modeError}
fullWidth
>
{types.map(option => (
<MenuItem key={option} value={option}>
{option}
</MenuItem>
))}
</TextField>
<DateTimePicker
autoOk
disableFuture
format="DD' at 'HH:mm"
ampm={false}
showTabs={false}
leftArrowIcon={<ChevronLeft />}
rightArrowIcon={<ChevronRight />}
value={this.state.endDatetime}
label='Backtest End Date'
onChange={newVal => this.setState({ endDatetime: newVal })}
className={classNames(classes.form, classes.textField)}
fullWidth
/>
{ this.state.mode == "Backtest" &&
<React.Fragment>
<DateTimePicker
autoOk
disableFuture
format="DD' at 'HH:mm"
ampm={false}
showTabs={false}
leftArrowIcon={<ChevronLeft />}
rightArrowIcon={<ChevronRight />}
value={this.state.beginDatetime}
label='Backtest Start Date'
onChange={newVal => this.setState({ beginDatetime: newVal })}
className={classNames(classes.form, classes.textField)}
fullWidth
/>
<TextField
id="waitTime"
label="Wait Time"
className={classNames(classes.form, classes.textField)}
value={this.state.waitTime}
onChange={(e)=>this.setState({waitTime:e.target.value})}
fullWidth
/>
</React.Fragment>
}
<DateTimePicker
autoOk
disableFuture
format="DD' at 'HH:mm"
ampm={false}
showTabs={false}
leftArrowIcon={<ChevronLeft />}
rightArrowIcon={<ChevronRight />}
value={this.state.endDatetime}
label='Backtest End Date'
onChange={newVal => this.setState({ endDatetime: newVal })}
className={classNames(classes.form, classes.textField)}
fullWidth
/>
<Typography className={classes.typography} variant='subtitle1' align='justify'>
If Run as Team is selected, the clone will be taken from the
team respository instead of your own team member folder.
Competitions runs from the team respository.
</Typography>
<FormControlLabel
control={
<Checkbox
checked={this.state.runAsTeam}
onChange={(e)=>this.setState({runAsTeam:e.target.checked })}
value="runAsTeam"
color="primary"
/>
}
label="Run as Team"
className={classNames(classes.form, classes.textField)}
/>
<TextField
id="waitTime"
label="Wait Time"
className={classNames(classes.form, classes.textField)}
value={this.state.waitTime}
onChange={(e)=>this.setState({waitTime:e.target.value})}
fullWidth
/>
</React.Fragment>
}
<Typography className={classes.typography} variant='subtitle1' align='justify'>
The Resume Execution option let's you pick up the context of
the last execution and continue from there.
</Typography>
<FormControlLabel
control={
<Checkbox
checked={this.state.resumeExecution}
onChange={(e)=>this.setState({resumeExecution:e.target.checked })}
value="resumeExecution"
color="primary"
/>
}
label="Resume Execution"
className={classNames(classes.form, classes.textField)}
/>
<Typography className={classes.typography} variant='subtitle1' align='justify'>
If Run as Team is selected, the clone will be taken from the
team respository instead of your own team member folder.
Competitions runs from the team respository.
</Typography>
<FormControlLabel
control={
<Checkbox
checked={this.state.runAsTeam}
onChange={(e)=>this.setState({runAsTeam:e.target.checked })}
value="runAsTeam"
color="primary"
/>
}
label="Run as Team"
className={classNames(classes.form, classes.textField)}
/>
<Typography className={classes.typography} variant='subtitle1' align='justify'>
The Resume Execution option let's you pick up the context of
the last execution and continue from there.
</Typography>
<FormControlLabel
control={
<Checkbox
checked={this.state.resumeExecution}
onChange={(e)=>this.setState({resumeExecution:e.target.checked })}
value="resumeExecution"
color="primary"
/>
}
label="Resume Execution"
className={classNames(classes.form, classes.textField)}
/>
</React.Fragment>
}
{ /* INDICATOR AND EXTRACTOR BOTS */ }
{ (this.state.selectedBot.kind === "INDICATOR"
|| this.state.selectedBot.kind === "EXTRACTOR") &&
<React.Fragment>
<TextField
label="Process Name"
className={classNames(classes.textField, classes.form)}
value={this.state.processName}
onChange={(e)=> this.setState({processName:e.target.value})}
onBlur={(e)=>this.setState({processNameError:false})}
error={this.state.processNameError}
fullWidth
/>
<TextField
select
label="Running Mode"
className={classNames(classes.margin, classes.textField, classes.form)}
value={this.state.mode}
onChange={(e)=> this.setState({mode:e.target.value})}
onBlur={(e)=>this.setState({modeError:false})}
error={this.state.modeError}
fullWidth
>
{startModes.map(option => (
<MenuItem key={option} value={option}>
{option}
</MenuItem>
))}
</TextField>
{ this.state.mode === "All Months" &&
<React.Fragment>
<TextField
id="beginYearInput"
select
label="Start Year"
className={classNames(classes.textField, classes.form)}
value={this.state.startYear}
onChange={(e)=> this.setState({startYear:e.target.value})}
fullWidth
>
{getIndicatorYears().map((option, index) => (
<MenuItem key={option} value={index}>
{option}
</MenuItem>
))}
</TextField>
<TextField
id="endYearInput"
select
label="End Year"
className={classNames(classes.textField, classes.form)}
value={this.state.endYear}
onChange={(e)=> this.setState({endYear:e.target.value})}
fullWidth
>
{getIndicatorYears().map((option, index) => (
<MenuItem key={option} value={index}>
{option}
</MenuItem>
))}
</TextField>
</React.Fragment>
}
{ this.state.mode === "One Month" &&
<React.Fragment>
<TextField
id="beginYearInput"
select
label="Year"
className={classNames(classes.textField, classes.form)}
value={this.state.startYear}
onChange={(e)=> this.setState({startYear:e.target.value})}
fullWidth
>
{getIndicatorYears().map((option, index) => (
<MenuItem key={option} value={index}>
{option}
</MenuItem>
))}
</TextField>
<TextField
id="endYearInput"
select
label="Month"
className={classNames(classes.textField, classes.form)}
value={this.state.month}
onChange={(e)=> this.setState({month:e.target.value})}
fullWidth
>
{availableMonths.map(option => (
<MenuItem key={option} value={option}>
{option}
</MenuItem>
))}
</TextField>
</React.Fragment>
}
</React.Fragment>
}
<div className={classes.actionButton} >
<Button
@@ -268,6 +400,17 @@ class AddClone extends Component {
);
}
setSelectedBot(botId){
if(isDefined(this.financialBeings)){
for (var i = 0; i < this.financialBeings.length; i++) {
if(this.financialBeings[i].id === botId){
this.setState({selectedBot:this.financialBeings[i]})
return
}
}
}
}
async submitForm(e){
e.preventDefault()
let error = this.validate()
@@ -289,23 +432,28 @@ class AddClone extends Component {
async createCloneOnServer(){
let variables = {
clone:{
teamId: this.state.teamId,
botId: this.state.botId,
botId: this.state.selectedBot.id,
mode: this.state.mode,
resumeExecution: this.state.resumeExecution,
runAsTeam: this.state.runAsTeam
}
}
if(this.state.mode == "Backtest"){
if(this.state.mode === "Backtest"){
variables.clone.beginDatetime = this.state.beginDatetime.valueOf() / 1000|0
variables.clone.endDatetime = this.state.endDatetime.valueOf() / 1000|0
variables.clone.waitTime = this.state.waitTime
}
if(this.state.selectedBot.kind !== "TRADER"){
variables.clone.processName = this.state.processName
variables.clone.startYear = this.state.startYear
variables.clone.endYear = this.state.endYear
variables.clone.month = this.state.month
}
return this.props.addCloneMutation({
variables: variables
//refetchQueries: [{query: getClonesQuery}],
})
}
@@ -320,9 +468,8 @@ class AddClone extends Component {
if(!this.state.serverError)
this.setState({
teamId:'',
botId:'',
mode:'',
selectedBot: {'id':''},
mode: '',
resumeExecution: false,
beginDatetime: DateTime.local().minus({ days: 8 }).startOf('day'),
endDatetime: DateTime.local(),
@@ -331,6 +478,7 @@ class AddClone extends Component {
stateDatetime: 0,
createDatetime: 0,
runAsTeam: false,
processName: '',
//Error handlers
nameError: false,
@@ -339,16 +487,17 @@ class AddClone extends Component {
modeError: false,
isNewCloneConfirmationOpen: false,
serverResponse: '',
serverError: false
serverError: false,
processNameError: false
})
};
validate(){
let isError = false
if(this.state.teamId.length < 1) {
if(this.state.selectedBot.length < 1) {
isError = true
this.setState(state => ({ teamError: true }));
this.setState(state => ({ selectedBotError: true }));
}
if(this.state.mode.length < 1) {
@@ -356,6 +505,12 @@ class AddClone extends Component {
this.setState(state => ({ modeError: true }));
}
if(this.state.selectedBot.kind !== "TRADER"
&& this.state.processName.length < 1 ) {
isError = true
this.setState(state => ({ processNameError: true }));
}
return isError;
}
+130
View File
@@ -0,0 +1,130 @@
import React, { Component } from 'react'
import { graphql } from 'react-apollo'
import { clones } from '../../../GraphQL/Calls'
import TopBar from '../../BannerTopBar'
//import CloneDialog from './CloneDialog'
import ListClones from '../List/ListClones'
// Material-ui
import { Typography, Paper } from '@material-ui/core'
class HistoryClones extends Component {
constructor (props) {
super(props)
let user = localStorage.getItem('user')
this.state = {
user: JSON.parse(user)
}
}
render () {
let data = this.props.data
if (data.loading) {
return (
<TopBar
size='big'
title='Bot Clone History'
text='Loading your Bot Clones...'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
} else if (data.operations_HistoryClones && data.operations_HistoryClones.length > 0) {
return (
<React.Fragment>
<TopBar
size='medium'
title='Bot Clone History'
text='All your Bot Clones are here.'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
<div className='container'>
{
data.operations_HistoryClones.map((clone, i) => {
return (
<ListClones key={clone.id} currentClone={clone} isHistory={true}/>
)
})
}
</div>
</React.Fragment>
)
} else if (data.error) {
return (
<TopBar
size='big'
title='Bot Clone History'
text='Please login to gain access to your Bot Clones.'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
} else {
return (
<TopBar
size='big'
title='Bot Clone History'
text="You don't have any Clone yet. Once you create one you will find it here."
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
}
}
getBodyContent (data) {
if (data.loading) {
return (
<TopBar
size='big'
title='Manage your Bot Clones'
text='Loading Bot Clones...'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
} else if (data.operations_HistoryClones && data.operations_HistoryClones.length > 0) {
return (
<React.Fragment>
<TopBar
size='big'
title='Manage your Bot Clones'
text='Loading Bot Clones...'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
<div className='container'>
{
data.operations_HistoryClones.map((clone, i) => {
return (
<ListClones key={clone.id} currentClone={clone} />
)
})
}
</div>
</React.Fragment>
)
} else if (data.error) {
return (
<TopBar
size='big'
title='No Bot Clones to display'
text='Please Login to access your Bot Clones.'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
} else {
return (
<TopBar
size='big'
title='No Bot Clones to display'
text="You don't have any Bot Clone yet. After you create a new Clone, it will be listed here."
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
}
}
}
export default graphql(clones.OPERATIONS_HISTORY_CLONES)(HistoryClones)
+105 -59
View File
@@ -11,7 +11,7 @@ import {
ExpansionPanelActions, Chip, Divider
} from '@material-ui/core'
import Avatar from '@material-ui/core/Avatar';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { isDefined, toLocalTime } from '../../../utils'
@@ -37,10 +37,12 @@ class ListClones extends Component {
<ExpansionPanel className={classes.root}>
<ExpansionPanelSummary expandIcon={<ExpandMoreIcon />}>
<div className={classes.heading}>
<Typography className={classes.heading}>{clone.teamId}</Typography>
<Avatar src={clone.teamAvatar} className={classes.avatar} />
<Typography className={classes.heading}>{clone.teamName}</Typography>
</div>
<div className={classes.heading}>
<Typography className={classes.heading}>{clone.botId}</Typography>
<Avatar src={clone.botAvatar} className={classes.avatar} />
<Typography className={classes.heading}>{clone.botName}</Typography>
</div>
<div className={classes.heading}>
<Typography className={classes.heading}>{clone.mode}</Typography>
@@ -48,36 +50,70 @@ class ListClones extends Component {
</ExpansionPanelSummary>
<Divider />
<ExpansionPanelDetails className={classes.details}>
<div className={classes.column}>
<Typography className={classes.cloneInfo1}>Created:</Typography>
{ isDefined(clone.beginDatetime) &&
<Typography className={classes.cloneInfo1}>Begin:</Typography>
}
{ isDefined(clone.endDatetime) &&
<Typography className={classes.cloneInfo1}>End:</Typography>
}
{ isDefined(clone.waitTime) &&
<Typography className={classes.cloneInfo1}>Wait Time:</Typography>
}
<Typography className={classes.cloneInfo1}>Resume Execution:</Typography>
<Typography className={classes.cloneInfo1}>Run As Team:</Typography>
</div>
<div className={classes.column2}>
<Typography className={classes.cloneInfo2}>{toLocalTime(clone.createDatetime)}</Typography>
{ isDefined(clone.beginDatetime) &&
<Typography className={classes.cloneInfo2}>{toLocalTime(clone.beginDatetime)}</Typography>
}
{ isDefined(clone.endDatetime) &&
<Typography className={classes.cloneInfo2}>{toLocalTime(clone.endDatetime)}</Typography>
}
{ isDefined(clone.waitTime) &&
<Typography className={classes.cloneInfo2}>{clone.waitTime}</Typography>
}
<Typography className={classes.cloneInfo2}>{clone.resumeExecution ? 'Yes':'No'}</Typography>
<Typography className={classes.cloneInfo2}>{clone.runAsTeam ? 'Yes':'No'}</Typography>
<div className={classes.column3}>
<Typography className={classes.cloneInfoTitle}>Context Information</Typography>
<div className={classes.details}>
<div className={classes.column4}>
<Typography className={classes.cloneInfoBold}>Created:</Typography>
{ isDefined(clone.beginDatetime) &&
<Typography className={classes.cloneInfoBold}>Begin:</Typography>
}
{ isDefined(clone.endDatetime) &&
<Typography className={classes.cloneInfoBold}>End:</Typography>
}
{ isDefined(clone.waitTime) &&
<Typography className={classes.cloneInfoBold}>Wait Time:</Typography>
}
<Typography className={classes.cloneInfoBold}>Resume Execution:</Typography>
<Typography className={classes.cloneInfoBold}>Run As Team:</Typography>
</div>
<div className={classes.column4}>
<Typography className={classes.cloneInfoNormal}>{toLocalTime(clone.createDatetime)}</Typography>
{ isDefined(clone.beginDatetime) &&
<Typography className={classes.cloneInfoNormal}>{toLocalTime(clone.beginDatetime)}</Typography>
}
{ isDefined(clone.endDatetime) &&
<Typography className={classes.cloneInfoNormal}>{toLocalTime(clone.endDatetime)}</Typography>
}
{ isDefined(clone.waitTime) &&
<Typography className={classes.cloneInfoNormal}>{clone.waitTime}</Typography>
}
<Typography className={classes.cloneInfoNormal}>{clone.resumeExecution ? 'Yes':'No'}</Typography>
<Typography className={classes.cloneInfoNormal}>{clone.runAsTeam ? 'Yes':'No'}</Typography>
</div>
</div>
</div>
<div className={classNames(classes.column3, classes.helper)}>
<Typography className={classes.cloneInfo1}>Virtual Machine Status</Typography>
<Typography className={classes.cloneInfoTitle}>Execution Information</Typography>
<div className={classes.details}>
<div className={classes.column4}>
<Typography className={classes.cloneInfoBold}>Last Execution:</Typography>
{ (clone.kind === 'TRADER' && isDefined(clone.assetA) ) &&
<React.Fragment>
<Typography className={classes.cloneInfoBold}>Buy Average:</Typography>
<Typography className={classes.cloneInfoBold}>Sell Average:</Typography>
<Typography className={classes.cloneInfoBold}>Market Rate:</Typography>
<Typography className={classes.cloneInfoBold}>ROI {clone.assetA}:</Typography>
<Typography className={classes.cloneInfoBold}>ROI {clone.assetB}:</Typography>
</React.Fragment>
}
</div>
<div className={classes.column4}>
<Typography className={classes.cloneInfoNormal}>{isDefined(clone.summaryDate) ? toLocalTime(clone.summaryDate): 'waiting update...'}</Typography>
{ ((clone.kind === 'INDICATOR' || clone.kind === 'EXTRACTOR') && isDefined(clone.assetA) ) &&
<React.Fragment>
<Typography className={classes.cloneInfoNormal}>{clone.buyAverage}</Typography>
<Typography className={classes.cloneInfoNormal}>{clone.sellAverage}</Typography>
<Typography className={classes.cloneInfoNormal}>{clone.marketRate}</Typography>
<Typography className={classes.cloneInfoNormal}>{clone.combinedProfitsA}</Typography>
<Typography className={classes.cloneInfoNormal}>{clone.combinedProfitsB}</Typography>
</React.Fragment>
}
</div>
</div>
</div>
<div className={classNames(classes.column3, classes.helper)}>
<Typography className={classes.cloneInfoTitle}>Virtual Machine Status</Typography>
<TextField
id="outlined-state"
defaultValue={clone.state}
@@ -90,21 +126,27 @@ class ListClones extends Component {
/>
</div>
</ExpansionPanelDetails>
<Divider />
<ExpansionPanelActions>
<Button
className={classes.buttonList}
variant='contained' color='secondary' size='small'
onClick={() => this.setState({ isLogsDialogOpen: true })}>
View Logs
</Button>
<Button
className={classes.buttonList}
variant='contained' color='secondary' size='small'
onClick={this.handleRemoveDialogOpen}>
Delete
</Button>
</ExpansionPanelActions>
{
!this.props.isHistory &&
<Divider />
}
{
!this.props.isHistory &&
<ExpansionPanelActions>
<Button
className={classes.buttonList}
variant='contained' color='secondary' size='small'
onClick={() => this.setState({ isLogsDialogOpen: true })}>
View Logs
</Button>
<Button
className={classes.buttonList}
variant='contained' color='secondary' size='small'
onClick={this.handleRemoveDialogOpen}>
Delete
</Button>
</ExpansionPanelActions>
}
</ExpansionPanel>
<Dialog
@@ -146,19 +188,23 @@ class ListClones extends Component {
Last clone logs
</DialogTitle>
<DialogContent className={classes.logsDialog}>
<TextField
id="outlined-logs"
label="Last Logs"
defaultValue={this.props.currentClone.lastLogs}
className={classes.textArea}
margin="normal"
InputProps={{
readOnly: true,
}}
variant="outlined"
fullWidth
multiline
/>
<Typography className={classes.typography} variant='subtitle1' align='justify'>
Here you can check the clone output directly from the virtual machine.
The last 20 lines are displayed, but you can check the Logs Module for more details.
</Typography>
<div className={classes.logsWrapper}>
<TextField
id="outlined-logs"
defaultValue={this.props.currentClone.lastLogs}
className={classes.textArea}
margin="normal"
InputProps={{
readOnly: true,
}}
fullWidth
multiline
/>
</div>
</DialogContent>
<DialogActions>
<Button onClick={this.handleLogsDialogClose} className={classes.buttonList}
+8 -8
View File
@@ -27,7 +27,7 @@ class BrowseClones extends Component {
size='big'
title='Your Bot Clones'
text='Loading your Bot Clones...'
backgroundUrl='https://advancedalgos.net/img/photos/ecosystem.jpg'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
} else if (data.operations_Clones && data.operations_Clones.length > 0) {
@@ -37,7 +37,7 @@ class BrowseClones extends Component {
size='medium'
title='Your Bot Clones'
text='All your Bot Clones are here.'
backgroundUrl='https://advancedalgos.net/img/photos/ecosystem.jpg'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
<div className='container'>
@@ -57,7 +57,7 @@ class BrowseClones extends Component {
size='big'
title='Your Bot Clones'
text='Please login to gain access to your Bot Clones.'
backgroundUrl='https://advancedalgos.net/img/photos/ecosystem.jpg'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
} else {
@@ -66,7 +66,7 @@ class BrowseClones extends Component {
size='big'
title='Your Bot Clones'
text="You don't have any Bot Clone yet. Once you create one you will find it here."
backgroundUrl='https://advancedalgos.net/img/photos/ecosystem.jpg'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
}
@@ -79,7 +79,7 @@ class BrowseClones extends Component {
size='big'
title='Manage your Bot Clones'
text='Loading Bot Clones...'
backgroundUrl='https://advancedalgos.net/img/photos/ecosystem.jpg'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
} else if (data.operations_Clones && data.operations_Clones.length > 0) {
@@ -89,7 +89,7 @@ class BrowseClones extends Component {
size='big'
title='Manage your Bot Clones'
text='Loading Bot Clones...'
backgroundUrl='https://advancedalgos.net/img/photos/ecosystem.jpg'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
<div className='container'>
@@ -109,7 +109,7 @@ class BrowseClones extends Component {
size='big'
title='No Bot Clones to display'
text='Please Login to access your Bot Clones.'
backgroundUrl='https://advancedalgos.net/img/photos/ecosystem.jpg'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
} else {
@@ -119,7 +119,7 @@ class BrowseClones extends Component {
size='big'
title='No Bot Clones to display'
text="You don't have any Bot Clone yet. After you create a new Clone, it will be listed here."
backgroundUrl='https://advancedalgos.net/img/photos/ecosystem.jpg'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
)
}
+30 -21
View File
@@ -1,7 +1,6 @@
const styles = theme => ({
root: {
flexGrow: 1,
padding: 10,
margin: 10
},
image: {
@@ -33,49 +32,59 @@ const styles = theme => ({
marginRight: theme.spacing.unit,
},
textArea: {
width:'1750px',
marginLeft: theme.spacing.unit,
marginRight: theme.spacing.unit,
whiteSpace: 'pre',
overflowY:'auto',
overflowX:'hidden'
},
heading: {
fontSize: theme.typography.pxToRem(18),
flexBasis: '33.33%',
fontWeight: '600'
fontWeight: '600',
whiteSpace: 'nowrap',
display: 'inline-flex',
alignItems: 'center',
paddingRight: theme.typography.pxToRem(20)
},
helper: {
borderLeft: `2px solid ${theme.palette.divider}`,
padding: `${theme.spacing.unit}px ${theme.spacing.unit * 2}px`,
padding: `0px ${theme.spacing.unit * 2}px`,
},
logsDialog:{
width:'1750px',
overflowY:'auto',
overflowY:'hidden',
overflowX:'hidden'
},
logsWrapper:{
overflowY:'auto',
overflowX:'auto'
},
details:{
display:'flex'
},
column: {
flexBasis: '15%',
maxWidth: '15%'
},
column2: {
flexBasis: '42.5%',
maxWidth: '42.5%'
flexBasis: '50%',
maxWidth: '50%'
},
column3: {
flexBasis: '42.5%',
maxWidth: '42.5%'
flexBasis: '33.33%',
maxWidth: '33.33%'
},
cloneInfo1:{
cloneInfoTitle:{
fontWeight: '600',
paddingLeft: '16px',
paddingTop: '16px'
flexBasis: '100%',
maxWidth: '100%'
},
cloneInfo2:{
paddingLeft: '16px',
paddingTop: '16px'
cloneInfoBold:{
fontWeight: '600',
paddingLeft: '10px',
paddingTop: '10px'
},
cloneInfoNormal:{
paddingLeft: '10px',
paddingTop: '10px'
},
avatar: {
margin: 10,
},
})
-87
View File
@@ -1,87 +0,0 @@
import React, { Component } from 'react'
import {graphql, compose} from 'react-apollo'
import { getAuditLog } from '../../../queries'
import { Table, TableBody, TableCell, TableHead, TableRow, Typography } from '@material-ui/core';
import { withStyles } from '@material-ui/core/styles'
import { toLocalTime } from '../../../utils'
const styles = theme => ({
root: {
flexGrow: 1,
padding: 20,
margin: 10
}
});
class AuditLogList extends Component {
constructor(props){
super(props)
const key = this.props.currentKey
this.state = {
id: key.id,
key: key.key,
date:'',
action: ''
}
}
render() {
const { classes } = this.props
var data = this.props.data
if(data.loading){
return <Typography className={classes.root} variant='subtitle1'>Loading...</Typography>
}else{
if(!data.keyVault_AuditLogs){
return <Typography className={classes.root} variant='subtitle1'>There has been an erorr.</Typography>
}
if(data.keyVault_AuditLogs.length === 0){
return <Typography className={classes.root} variant='subtitle1'>There is no audit history for this key.</Typography>
}
return (
<Table className={classes.table}>
<TableHead>
<TableRow>
<TableCell>Date</TableCell>
<TableCell>Action</TableCell>
<TableCell>Details</TableCell>
</TableRow>
</TableHead>
<TableBody>
{data.keyVault_AuditLogs.map(row => {
return (
<TableRow key={row.id}>
<TableCell component="th" scope="row">
{toLocalTime(row.date)}
</TableCell>
<TableCell>{row.action}</TableCell>
<TableCell>{row.details}</TableCell>
</TableRow>
);
})}
</TableBody>
</Table>
)
}
}
}
export default compose(
graphql(getAuditLog, { // What follows is the way to pass a parameter to a query.
options: (props) => {
return {
variables: {
key: props.currentKey.id
}
}
}
}),
withStyles(styles)
)(AuditLogList)
+1 -1
View File
@@ -12,7 +12,7 @@ class Home extends Component {
size='big'
title='Operations Module'
text='Responsible for manage bot clones.'
backgroundUrl='https://advancedalgos.net/img/photos/ecosystem.jpg'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
<div className='homePage container'>
-3
View File
@@ -1,3 +0,0 @@
{
"lockfileVersion": 1
}
+1 -1
View File
@@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at feedback at advancedalgos dot org. 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.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at feedback at superalgos dot org. 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.
+17 -17
View File
@@ -2,44 +2,44 @@
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!
Advanced Algos LTD is a startup, currently at a very early stage. Although this repository is not open source software yet, we do welcome contributions from the community.
Superalgos is a collective project, currently at a very early stage. Although this repository is not open source software yet, we do welcome contributions from the community.
Contributions are deemed _voluntary work_. There might be incentives in place for certain kinds of contributions. Contact us for more information in this regards.
Contributions are deemed _voluntary work_. There might be incentives in place for certain kinds of contributions. Contact us for more information in this regard.
In any case, contributors agree to provide an express grant of patent rights for their contributions. Submitting Pull Requests to this repository represents an express agreement with the terms of our Balanced Contributor Intellectual Property Agreement. This agreement is a direct implementation of GitHub's [Balanced Employee Intellectual Property Agreement 1.0.1](https://github.com/github/balanced-employee-ip-agreement/blob/master/Balanced_Employee_IP_Agreement.md).
# Balanced Contributor Intellectual Property Agreement 1.0.1
This BALANCED CONTRIBUTOR INTELLECTUAL PROPERTY AGREEMENT is between person or team submitting Pull Requests to this repository and Advanced Algos LTD ("Company").
This BALANCED CONTRIBUTOR INTELLECTUAL PROPERTY AGREEMENT is between person or team submitting Pull Requests to this repository and Superalgos.org ("Project").
**What is this?** This is the Company's Intellectual Property Agreement ("Agreement"). If you've worked in the technology space before, there's a good chance that you've run across one or more of these in the past. This document is the official, entire and exclusive agreement on what intellectual property ("IP") is yours, and what belongs to the Company.
**What is this?** This is the Project's Intellectual Property Agreement ("Agreement"). If you've worked in the technology space before, there's a good chance that you've run across one or more of these in the past. This document is the official, entire and exclusive agreement on what intellectual property ("IP") is yours, and what belongs to the Project.
**Why is this?** The Company needs to be clear on what IP it owns and has rights to. Its customers, contributors, and investors depend on the Company having the legal rights to the products and services it is providing so that the Company can continue operating and doing business.
**Why is this?** The Project needs to be clear on what IP it owns and has rights to. Its customers, contributors, and investors depend on the Project having the legal rights to the products and services it is providing so that the Project can continue operating and doing business.
The Company also believes that it's important to be clear on what it doesn't own. The Company doesn't want you looking over your shoulder every time you work on something personal or worrying that the Company will someday seize your open source non-lethal mousetrap simulation software. In other words, the Company isn't interested in appropriating your personal projects.
The Project also believes that it's important to be clear on what it doesn't own. The Project doesn't want you looking over your shoulder every time you work on something personal or worrying that the Project will someday seize your open source non-lethal mousetrap simulation software. In other words, the Project isn't interested in appropriating your personal projects.
**Read this.** Please read this document and be sure you understand it before you submit any Pull Requests. Due to legal risk and corporate obligations, the Company cannot, by and large, negotiate its terms. If you feel you have a particular circumstance that keeps you from signing, please let the Company's legal department ("Legal") know. And, of course, you're always free and encouraged to get your own legal counsel to explain anything you're not clear on.
**Read this.** Please read this document and be sure you understand it before you submit any Pull Requests. Due to legal risk and corporate obligations, the Project cannot, by and large, negotiate its terms. If you feel you have a particular circumstance that keeps you from signing, please let the Project's legal department ("Legal") know. And, of course, you're always free and encouraged to get your own legal counsel to explain anything you're not clear on.
Cool? Then, by submitting your first Pull Request, and as a condition of your contribution, you agree to the following:
1. **What the Company owns.** The Company owns any IP ("Company IP") that you create, or help create _as its contributor_, but only if it meets one or more of these additional conditions: The IP was (i) related to an existing or prospective Company product or service at the time you developed, invented, or created it, (ii) developed for use by the Company, or (iii) developed or promoted with existing Company IP or with the Company's endorsement. You hereby grant and assign, and will grant and assign, to the Company all rights and interests in all Company IP.
1. **What the Project owns.** The Project owns any IP ("Project IP") that you create, or help create _as its contributor_, but only if it meets one or more of these additional conditions: The IP was (i) related to an existing or prospective Project product or service at the time you developed, invented, or created it, (ii) developed for use by the Project, or (iii) developed or promoted with existing Project IP or with the Project's endorsement. You hereby grant and assign, and will grant and assign, to the Project all rights and interests in all Project IP.
"Company IP" includes concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, and works of authorship.
"Project IP" includes concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, and works of authorship.
2. **What the Company doesn't own.** If you create IP that doesn't fit into one of the categories listed above, the Company doesn't own it. In other words, the Company doesn't own concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, or works of authorship that you develop, invent, or create that do not meet any of the conditions in Section 1.
2. **What the Project doesn't own.** If you create IP that doesn't fit into one of the categories listed above, the Project doesn't own it. In other words, the Project doesn't own concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, or works of authorship that you develop, invent, or create that do not meet any of the conditions in Section 1.
3. **Contribution of your IP to Company projects.** If you include your own IP – such as IP you created prior to working for the Company – into a Company product or service, it's still yours, of course, but you grant the Company a non-exclusive, irrevocable, fully paid-up, royalty-free, perpetual, sublicensable, transferable, worldwide license to use it without restriction in any way or implementation, in modified form, or as is, by itself, or incorporated into another product or service ("License"). If you include your name in any project over which the Company would have rights under this Agreement, such as in a copyright notice or a comment in code or documentation, then the License covers the rights associated with that use of your name as well.
3. **Contribution of your IP to Project projects.** If you include your own IP – such as IP you created prior to working for the Project – into a Project product or service, it's still yours, of course, but you grant the Project a non-exclusive, irrevocable, fully paid-up, royalty-free, perpetual, sublicensable, transferable, worldwide license to use it without restriction in any way or implementation, in modified form, or as is, by itself, or incorporated into another product or service ("License"). If you include your name in any project over which the Project would have rights under this Agreement, such as in a copyright notice or a comment in code or documentation, then the License covers the rights associated with that use of your name as well.
4. **Your contributions to non-Company projects.** The Company recognizes that you may be engaged in work that requires you to submit IP to entities other than the Company, such as open source projects used by the Company. Please make sure that Legal is aware of what you're working on so that Legal can help with any licensing issues. If any project asks you to sign a contribution agreement, you should check with Legal before doing so. These agreements may be legally binding on the Company and so should be run through Legal first.
4. **Your contributions to non-Project projects.** The Project recognizes that you may be engaged in work that requires you to submit IP to entities other than the Project, such as open source projects used by the Project. Please make sure that Legal is aware of what you're working on so that Legal can help with any licensing issues. If any project asks you to sign a contribution agreement, you should check with Legal before doing so. These agreements may be legally binding on the Project and so should be run through Legal first.
5. **Voluntary Works** All Company IP that you are involved with or create as part of your work for the Company is voluntary work which does not require compensation. There might be incentives in place for certain kinds of contributions. Feel free to contact the Company to learn more.
5. **Voluntary Works** All Project IP that you are involved with or create as part of your work for the Project is voluntary work which does not require compensation. There might be incentives in place for certain kinds of contributions. Feel free to contact the Project to learn more.
6. **No conflicts.** You agree that you don't have any outstanding agreements or obligations that conflict with those in this Agreement, and that you won't enter into conflicting agreements in the future.
7. **IP protection.** The Company might someday need to show the work that went into the development of IP that it uses or has used, or to make government filings to establish that it owns the IP or has rights over it. To help in those situations, you agree not to destroy any records you maintain relating to the development of any Company IP or IP under License (together, "All IP"), and, if the Company asks, to provide those records to the Company. You agree to help the Company secure and defend its rights in All IP. For your help the Company will compensate you at a reasonable rate. If the Company is unable to secure your help, you authorize the Company to act on your behalf (as your agent and attorney-in-fact) in securing all rights related to All IP.
7. **IP protection.** The Project might someday need to show the work that went into the development of IP that it uses or has used, or to make government filings to establish that it owns the IP or has rights over it. To help in those situations, you agree not to destroy any records you maintain relating to the development of any Project IP or IP under License (together, "All IP"), and, if the Project asks, to provide those records to the Project. You agree to help the Project secure and defend its rights in All IP. For your help the Project will compensate you at a reasonable rate. If the Project is unable to secure your help, you authorize the Project to act on your behalf (as your agent and attorney-in-fact) in securing all rights related to All IP.
8. **Confidentiality.** As an contributor or contractor of the Company, you will have access to sensitive confidential information that is important to the Company's business. You are responsible for keeping this information confidential, including after you end your work for the Company.
8. **Confidentiality.** As an contributor or contractor of the Project, you will have access to sensitive confidential information that is important to the Project's business. You are responsible for keeping this information confidential, including after you end your work for the Project.
"Confidential Information" includes non-public technical details about our products or services, financial information, business strategies and forecasts, customer data, or any other information, data or know-how that is valuable to the Company because it is not publicly known.
"Confidential Information" includes non-public technical details about our products or services, financial information, business strategies and forecasts, customer data, or any other information, data or know-how that is valuable to the Project because it is not publicly known.
The Company's Confidential Information is sensitive and we expect that you'll treat it as such. You agree to only use the Company's Confidential Information for the purpose of performing your contribution and for the benefit of the Company. You will do your best to keep Confidential Information secret. If you are not sure if something is Confidential Information, you should assume that it is, until you can confirm otherwise.
The Project's Confidential Information is sensitive and we expect that you'll treat it as such. You agree to only use the Project's Confidential Information for the purpose of performing your contribution and for the benefit of the Project. You will do your best to keep Confidential Information secret. If you are not sure if something is Confidential Information, you should assume that it is, until you can confirm otherwise.
+14 -17
View File
@@ -1,23 +1,22 @@
COPYRIGHT NOTICE
© Copyright 2018 Advanced Algos LTD.
© Copyright 2018 Superalgos.org
LICENSE NOTICE
Advanced Algos LTD. is a startup, currently at a very early stage. Because certain aspects of
the business are still not clearly defined, we have chosen to --temporarily-- grant a
restrictive license for the use of this repository, until those business aspects are clarified
and a proper open source license can be granted.
Superalgos is a collaborative project currently at a very early stage. Because certain aspects of
the project are still not clearly defined, we have chosen to --temporarily-- grant a restrictive
license for the use of this repository, until those aspects are clarified and a proper open source
license can be granted.
Advanced Algos LTD. is publishing the code of this software for several reasons. However,
it shall not be considered free software yet. Advanced Algos LTD. is a for-profit company
in the crypto space and this module is still proprietary software.
Superalgos.org is publishing the code of this software for several reasons. However, it shall not be considered free software yet. Superalgos is a collaborative project in the crypto space and this
software is still proprietary software.
The reasons for opening up the code of this module at this stage are the following:
The reasons for opening up the code of this software at this stage are the following:
* We believe that transparency is paramount to achieving our goals, so we want everyone
to be able to understand what this module does and how. Opening up the code of this module
* We believe that transparency is paramount to achieving our goals, so we want everyone to
be able to understand what this software does and how. Opening up the code of this software
allows anyone to take a close look.
* We welcome contributions from the community. Contributions are regarded as voluntary work.
@@ -27,16 +26,14 @@ The reasons for opening up the code of this module at this stage are the followi
LICENSE WORDING
Advanced Algos LTD. grants a limited license for the following uses:
Superalgos.org grants a limited license for the following uses:
1. CODE REVIEW AND AUDITS. You are granted permission to clone this repository to analyze,
review or audit the code.
2. COLLABORATING WITH ADVANCED ALGOS LTD. You are granted permission to fork this repository
2. COLLABORATING WITH Superalgos.org. You are granted permission to fork this repository
with the sole purpose of correcting bugs and developing functionality in agreement with
Advanced Algos LTD. By contributing to this repository you explicitely agree to the terms
Superalgos.org. By contributing to this repository you explicitely agree to the terms
detailed in CONTRIBUTING.MD.
PLEASE SEE CONTRIBUTING.MD FOR MORE DETAILS ON THE IMPLICATIONS SURROUNDING YOUR CONTRIBUTIONS TO THIS REPOSITORY.
PLEASE SEE CONTRIBUTING.MD FOR MORE DETAILS ON THE IMPLICATIONS SURROUNDING YOUR CONTRIBUTIONS TO THIS REPOSITORY.
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "operations-server",
"version": "1.0.0",
"description": "Advanced Algos Operations backend API",
"description": "Superalgos Operations backend API",
"main": "src/index.js",
"scripts": {
"start": "nodemon --exec babel-node --presets env,stage-2 src/index.js",
+1 -3
View File
@@ -7,11 +7,9 @@ env.push({
"value": process.env.PLATFORM_ENVIRONMENT
})
// FIXME
env.push({
"name": "GATEWAY_ENDPOINT",
"value": "https://platform-api-dev.advancedalgos.net/graphql"
//"value": process.env.GATEWAY_ENDPOINT
"value": process.env.GATEWAY_ENDPOINT
})
env.push({
+14
View File
@@ -7,3 +7,17 @@ export function toPlatformDatetime (epoch) {
export function isDefined (d) {
return d !== null && typeof d !== 'undefined'
}
export function getJobNameFromClone (teamSlug, botSlug, mode) {
return teamSlug + '-' + botSlug + '-' + mode.toLowerCase()
}
export function getSelectedBot(botsByUser, selectedBotId){
if(isDefined(botsByUser)){
for (var i = 0; i < botsByUser.fb.length; i++) {
if(botsByUser.fb[i].id === selectedBotId){
return botsByUser.fb[i]
}
}
}
}
+12 -6
View File
@@ -1,11 +1,17 @@
export const LIVE = 'Live';
export const BACKTEST = 'Backtest';
export const COMPETITION = 'Competition';
export const LIVE = 'Live'
export const BACKTEST = 'Backtest'
export const COMPETITION = 'Competition'
export const ALL_MONTHS = 'All Months'
export const ONE_MONTH = 'One Month'
export const NO_TIME = 'No Time'
export const CloneModeEnum = [
LIVE,
BACKTEST,
COMPETITION
];
COMPETITION,
ALL_MONTHS,
ONE_MONTH,
NO_TIME
]
export default CloneModeEnum;
export default CloneModeEnum
-2
View File
@@ -41,8 +41,6 @@ export class OperationsError extends Error {
message = 'OperationsModule Internal Error. ' + this.message
constructor(message){
super(message)
logger.error(this.stack)
this.stack = ''
}
}
+30
View File
@@ -0,0 +1,30 @@
import logger from '../config/logger'
import axios from 'axios'
const teamAvatar = async(authorization, teamId) => {
logger.debug('GraphQL call teamAvatar.')
return axios({
url: process.env.GATEWAY_ENDPOINT,
method: 'post',
data: {
query: `
query Teams_Team($teamId: String!){
teams_TeamById(teamId:$teamId) {
profile{
avatar
}
}
}
`,
variables: {
teamId: teamId
}
},
headers: {
authorization: authorization
}
})
};
export default teamAvatar
@@ -0,0 +1,39 @@
import logger from '../config/logger'
import axios from 'axios'
const teams_FbByTeamMember = (authorization) => {
logger.debug('GraphQL call teams_FbByTeamMember')
return axios({
url: process.env.GATEWAY_ENDPOINT,
method: 'post',
data: {
query: `
query Teams_FbByTeamMember {
teams_FbByTeamMember {
id
name
slug
fb {
id
name
slug
kind
avatar
}
members {
member {
alias
}
}
}
}
`,
},
headers: {
authorization: authorization
}
})
};
export default teams_FbByTeamMember
+53 -46
View File
@@ -1,5 +1,5 @@
import logger from '../config/logger'
import { toPlatformDatetime } from '../config/utils'
import { toPlatformDatetime, getJobNameFromClone, isDefined } from '../config/utils'
import envConfig from '../config/envConfig'
import { KubernateError } from '../errors'
import { Client, config } from 'kubernetes-client'
@@ -7,91 +7,98 @@ import { Client, config } from 'kubernetes-client'
import deploymentManifest from '../config/clone-deployment.json'
import { BACKTEST} from '../enums/CloneMode';
const createClone = async (clone, cloneName) => {
const createClone = async (clone, teamSlug, botSlug) => {
try {
logger.info("createClone %j", cloneName)
let cloneName = getJobNameFromClone(teamSlug, botSlug, clone.mode)
logger.info("createClone %s", cloneName)
const client = new Client({config: config.fromKubeconfig(), version: '1.9'})
// Make changes to base deployment config
deploymentManifest.metadata.name = cloneName
logger.debug("createClone Set basic environment configuration.")
logger.debug("createClone Environment and Auth Configuration.")
let env = envConfig
logger.debug("createClone Configuration for team, bot and process.")
logger.debug("createClone General Financial Being Configuration.")
env.push({
"name": "DEV_TEAM",
"value": clone.teamId
})
env.push({
"name": "BOT",
"value": clone.botId
})
// TODO allow other types
env.push({
"name": "KIND",
"value": clone.kind
})
env.push({
"name": "PROCESS",
"value": "Trading-Process"
"value": clone.processName
})
// TODO allow other types
env.push({
"name": "TYPE",
"value": "Trading"
"name": "CLONE_ID",
"value": clone.id.toString()
})
env.push({
"name": "START_MODE",
"value": clone.mode.toLowerCase()
})
env.push({
"name": "RUN_AS_TEAM",
"value": clone.runAsTeam.toString()
})
env.push({
"name": "USER_LOGGED_IN",
"value": clone.userLoggedIn
})
logger.debug("createClone Configuration for the execution.")
env.push({
"name": "START_MODE",
"value": clone.mode.toLowerCase()
})
env.push({
"name": "RESUME_EXECUTION",
"value": clone.resumeExecution.toString()
})
if(clone.mode === BACKTEST){
logger.debug("createClone Trading Configuration.")
if(clone.kind === 'Trading'){
env.push({
"name": "BEGIN_DATE_TIME",
"value": toPlatformDatetime(clone.beginDatetime)
"name": "RESUME_EXECUTION",
"value": clone.resumeExecution.toString()
})
env.push({
"name": "END_DATE_TIME",
"value": toPlatformDatetime(clone.endDatetime)
})
env.push({
"name": "WAIT_TIME",
"value": clone.waitTime.toString()
})
if(clone.mode === BACKTEST){
env.push({
"name": "BEGIN_DATE_TIME",
"value": toPlatformDatetime(clone.beginDatetime)
})
env.push({
"name": "END_DATE_TIME",
"value": toPlatformDatetime(clone.endDatetime)
})
env.push({
"name": "WAIT_TIME",
"value": clone.waitTime.toString()
})
}
} else if(clone.kind === 'Indicator' || clone.kind === 'Extractor'){
env.push({
"name": "MIN_YEAR",
"value": isDefined(clone.startYear) ? clone.startYear.toString() : ''
})
env.push({
"name": "MAX_YEAR",
"value": isDefined(clone.endYear) ? clone.endYear.toString() : ''
})
env.push({
"name": "MONTH",
"value": isDefined(clone.month) ? clone.month.toString() : ''
})
env.push({
"name": "INTERVAL",
"value": isDefined(clone.interval) ? clone.interval.toString() : ''
})
}
deploymentManifest.spec.template.spec.containers[0].env = env
// Create a new Deployment
const create = await client.apis.batch.v1.namespaces('default').jobs.post(
{ body: deploymentManifest })
logger.debug("Create: %j ", create)
// Fetch the Deployment we just created
const deployment = await client.apis.batch.v1.namespaces('default').jobs(
deploymentManifest.metadata.name).get()
logger.debug("Job: %j ", deployment)
logger.info("createClone %j succesfull", cloneName)
logger.info("createClone %s on Kubernates success.", cloneName)
} catch (err) {
throw new KubernateError(err)
}
+7 -7
View File
@@ -2,9 +2,9 @@ import logger from '../config/logger'
import { KubernateError } from '../errors'
import { Client, config } from 'kubernetes-client'
const getClonePodStatus = async (cloneName) => {
const getClonePodLogs = async (cloneName) => {
try {
logger.info("getClonePodStatus %j", cloneName)
logger.debug("getClonePodLogs on kubernates started.")
const client = new Client({config: config.fromKubeconfig(), version: '1.9'})
let query = {
@@ -12,23 +12,23 @@ const getClonePodStatus = async (cloneName) => {
"labelSelector": "job-name="+cloneName
}
}
// Get the pod
const pod = await client.api.v1.namespaces('default').pods.get(query)
// logger.debug("pod: %j ", pod)
let queryLogs = {
"qs":{
"tailLines": "15"
"tailLines": "20"
}
}
const logs = await client.api.v1.namespaces('default')
.pods(pod.body.items[0].metadata.name).log.get(queryLogs)
let logsArray = logs.body.split('\n')
// logger.debug("logs: %j ", logsArray)
logger.debug("getClonePodLogs on kubernates successful.")
return JSON.stringify(logsArray, null, 2)
} catch (err) {
throw new KubernateError(err)
}
}
export default getClonePodStatus
export default getClonePodLogs
+3 -5
View File
@@ -4,7 +4,7 @@ import { Client, config } from 'kubernetes-client'
const getClonePodStatus = async (cloneName) => {
try {
logger.info("getClonePodStatus %j", cloneName)
logger.info("getClonePodStatus on kubernates started. ")
const client = new Client({config: config.fromKubeconfig(), version: '1.9'})
let query = {
@@ -12,18 +12,16 @@ const getClonePodStatus = async (cloneName) => {
"labelSelector": "job-name="+cloneName
}
}
// Get The Pod
const pod = await client.api.v1.namespaces('default').pods.get(query)
logger.debug("pod: %j ", pod)
let clonePodStatus = pod.body.items[0].status.containerStatuses[0].state
logger.debug("clonePodStatus: %j ", clonePodStatus)
if (clonePodStatus.hasOwnProperty('terminated')
&& clonePodStatus.terminated.hasOwnProperty('containerID')) {
delete clonePodStatus.terminated.containerID
}
logger.info("getClonePodStatus %j succesfull", cloneName)
logger.info("getClonePodStatus %s on kubernates successful", cloneName)
return JSON.stringify(clonePodStatus, null, 2)
} catch (err) {
throw new KubernateError(err)
+5 -7
View File
@@ -1,10 +1,12 @@
import logger from '../config/logger'
import { KubernateError } from '../errors'
import { Client, config } from 'kubernetes-client'
import { getJobNameFromClone } from '../config/utils'
const removeClone = async (cloneName) => {
const removeClone = async (clone, teamSlug, botSlug) => {
try {
logger.info("removeClone %j", cloneName)
let cloneName = getJobNameFromClone(teamSlug, botSlug, clone.mode)
logger.info("removeClone %s", cloneName)
const client = new Client({config: config.fromKubeconfig(), version: '1.9'})
let query = {
@@ -13,18 +15,14 @@ const removeClone = async (cloneName) => {
}
}
// Remove the Job
const removed = await client.apis.batch.v1.namespaces('default').jobs(
cloneName).delete()
logger.debug("Job Removed: %j ", removed)
// Get the pod
const pod = await client.api.v1.namespaces('default').pods.get(query)
const podRemoved = await client.api.v1.namespaces('default')
.pods(pod.body.items[0].metadata.name).delete()
logger.debug("Pod Removed: %j ", podRemoved)
logger.info("removeClone %j succesfull", cloneName)
logger.info("removeClone %s on kubernates succesful", cloneName)
} catch (err) {
throw new KubernateError(err)
}
+10 -1
View File
@@ -39,7 +39,16 @@ const cloneSchema = new Schema({
},
stateDatetime: Number,
createDatetime: Number,
runAsTeam: Boolean
runAsTeam: Boolean,
active: Boolean,
summaryDate: Number,
buyAverage: Number,
sellAverage: Number,
marketRate: Number,
combinedProfitsA: Number,
combinedProfitsB: Number,
assetA: String,
assetB: String
})
const Clone = mongoose.model('Clone', cloneSchema)
+19 -54
View File
@@ -1,7 +1,8 @@
import { CloneInputType } from '../types/input';
import { CloneType } from '../types';
import { Clone } from '../../models';
import { CloneModeEnum , BACKTEST} from '../../enums/CloneMode';
import { CloneModeEnum } from '../../enums/CloneMode';
import teams_FbByTeamMember from '../../graphQLCalls/teams_FbByTeamMember';
import {
AuthentificationError,
@@ -10,10 +11,9 @@ import {
CustomError
} from '../../errors'
import axios from 'axios';
import logger from '../../config/logger'
import createKubernetesClone from '../../kubernetes/createClone'
import { isDefined } from '../../config/utils'
import { isDefined, getSelectedBot } from '../../config/utils'
const args = {
clone: {type: CloneInputType }
@@ -30,69 +30,35 @@ const resolve = async(parent, { clone }, context) => {
throw new WrongArgumentsError('The mode selected is not valid.')
}
// Disable execution dates if mode is not backtest
if((clone.hasOwnProperty('beginDatetime')
|| clone.hasOwnProperty('endDatetime'))
&& clone.mode !== BACKTEST){
throw new WrongArgumentsError('Ony Backtest mode allows begin and end date selection.')
}
let existingClone = await Clone.find(
{
authId: context.userId,
mode: clone.mode
mode: clone.mode,
botId: clone.botId,
active: true
})
logger.debug('addClone -> Checking existing clone %j', existingClone)
if(isDefined(existingClone) && existingClone.length > 0){
throw new CustomError('You can only create one clone per mode. Remove the'
if(existingClone.length > 0){
throw new CustomError('You can only have one active clone by mode. Remove the'
+ ' existing clone of type: ' + clone.mode + ' and try again.')
}
logger.debug('addClone -> Creating a new clone. %j', clone)
try{
const userTeam = await axios({
url: process.env.GATEWAY_ENDPOINT,
method: 'post',
data: {
query: `
query Teams_FbByTeamMember {
teams_FbByTeamMember {
id
name
slug
fb {
id
name
slug
}
members {
member {
alias
}
}
}
}
`,
},
headers: {
authorization: context.authorization,
preshared: process.env.OPERATIONS_API_PRESHARED
}
})
clone.teamId = userTeam.data.data.teams_FbByTeamMember.slug
clone.botId = userTeam.data.data.teams_FbByTeamMember.fb[0].slug
clone.userLoggedIn = userTeam.data.data.teams_FbByTeamMember.members[0].member.alias
// Authorization is handled by the teams module
let botsByUser = await teams_FbByTeamMember(context.authorization)
let selectedBot = getSelectedBot(botsByUser.data.data.teams_FbByTeamMember, clone.botId)
clone.teamId = botsByUser.data.data.teams_FbByTeamMember.id
clone.botId = selectedBot.id
clone.userLoggedIn = botsByUser.data.data.teams_FbByTeamMember.members[0].member.alias //TODO change by context info if possible
clone.createDatetime = new Date().valueOf() / 1000|0
clone.active = true
logger.debug('addClone -> Creating a new clone. %j', clone)
let newClone = new Clone(clone)
await createKubernetesClone(clone, newClone._id)
newClone.id = newClone._id
newClone.authId = context.userId
await createKubernetesClone(newClone, botsByUser.data.data.teams_FbByTeamMember.slug, selectedBot.slug )
return new Promise((resolve, reject) => {
newClone.save((err) => {
@@ -102,14 +68,13 @@ const resolve = async(parent, { clone }, context) => {
}
else {
//TODO transaction on database
// saveAuditLog(newClone.id, 'addKey', context)
logger.debug('addClone -> Save clone sucessful.')
resolve(newClone)
}
})
})
} catch(error) {
logger.debug('addClone -> Error: %j', error)
} catch(err) {
logger.error('addClone -> Error: %s', err.stack)
throw new OperationsError('There has been an error creating the clone.')
}
}
@@ -12,10 +12,11 @@ import {
import { Clone } from '../../models'
import logger from '../../config/logger'
import removeKuberneteClone from '../../kubernetes/removeClone'
//import saveAuditLog from './AddAuditLog'
import teams_FbByTeamMember from '../../graphQLCalls/teams_FbByTeamMember'
import { isDefined, getSelectedBot } from '../../config/utils'
const args = {
id: {type: new GraphQLNonNull(GraphQLID)}
id: { type: new GraphQLNonNull(GraphQLID) }
}
const resolve = async (parent, { id }, context) => {
@@ -25,20 +26,37 @@ const resolve = async (parent, { id }, context) => {
throw new AuthentificationError()
}
await removeKuberneteClone(id)
let clone = await Clone.findOne({
_id: id,
authId: context.userId,
active: true
})
var query = {
if(!isDefined(clone)){
throw new CustomError('You are not authorized to remove this clone.')
}
// Authorization is also handled by the teams module
let botsByUser = await teams_FbByTeamMember(context.authorization)
let selectedBot = getSelectedBot(botsByUser.data.data.teams_FbByTeamMember, clone.botId)
logger.debug('removeClone -> Removing Clone from Kubernates.')
await removeKuberneteClone(clone, botsByUser.data.data.teams_FbByTeamMember.slug, selectedBot.slug)
const query = {
_id: id,
authId: context.userId
}
const options = { new: true }
const update = { active: false }
//saveAuditLog(id, 'removeClone', context)
logger.debug('removeClone -> Removing Clone from DB.')
Clone.deleteOne(query, function (err) {
Clone.findOneAndUpdate(query, update, options, (err, doc) => {
if (err){
logger.error('removeClone -> Error removing clone from the DB. %s', err.stack)
throw new OperationsError(err)
}else{
return 'Clone Removed'
logger.debug('removeClone -> Clone Removed from the DB.')
return('Clone Removed.')
}
})
}
@@ -0,0 +1,71 @@
import {
GraphQLNonNull,
GraphQLID,
GraphQLString,
GraphQLInt,
GraphQLFloat
} from 'graphql'
import {
OperationsError
} from '../../errors'
import { Clone } from '../../models'
import logger from '../../config/logger'
const args = {
id: { type: new GraphQLNonNull(GraphQLID) },
summaryDate: { type: GraphQLInt },
buyAverage: { type: GraphQLFloat },
sellAverage: { type: GraphQLFloat },
marketRate: { type: GraphQLFloat },
combinedProfitsA: { type: GraphQLFloat },
combinedProfitsB: { type: GraphQLFloat },
assetA: { type: GraphQLString },
assetB: { type: GraphQLString }
}
const resolve = async (parent,
{ id, summaryDate, buyAverage, sellAverage, marketRate, combinedProfitsA,
combinedProfitsB, assetA, assetB
}) => {
logger.debug('UpdateExecutionSummary -> Entering Function.')
const query = { _id: id }
const options = { new: true }
const update = {
summaryDate: summaryDate,
buyAverage: buyAverage,
sellAverage: sellAverage,
marketRate: marketRate,
combinedProfitsA: combinedProfitsA,
combinedProfitsB: combinedProfitsB,
assetA: assetA,
assetB: assetB
}
let sucessful
await Clone.findOneAndUpdate(query, update, options, (err, doc) => {
if (err){
throw new OperationsError(err)
} else {
logger.debug('Execution summary updated')
sucessful = true
}
})
if(sucessful){
return 'Execution summary updated.'
}
}
const mutation = {
updateExecutionSummary: {
type: GraphQLString,
args,
resolve
}
}
export default mutation
+3 -1
View File
@@ -4,12 +4,14 @@ import {
import AddCloneMutation from './AddCloneMutation'
import RemoveCloneMutation from './RemoveCloneMutation'
import UpdateExecutionSummary from './UpdateExecutionSummary'
const Mutation = new GraphQLObjectType({
name: 'Mutation',
fields: Object.assign(
AddCloneMutation,
RemoveCloneMutation
RemoveCloneMutation,
UpdateExecutionSummary
)
})
@@ -1,40 +0,0 @@
import {
GraphQLList,
GraphQLString,
GraphQLNonNull
} from 'graphql'
import {
AuthentificationError
} from '../../errors'
import { AuditLogType } from '../types'
import { AuditLog } from '../../models'
import logger from '../../config/logger'
const args = {
key: { type: new GraphQLNonNull(GraphQLString) }
}
const resolve = (parent, { key }, context) => {
logger.debug('auditLogs -> Entering Fuction.')
if (!context.userId) {
throw new AuthentificationError()
}
return AuditLog.find({
authId: context.userId,
keyId: key
}).sort({date: -1}).limit(20)
}
const query = {
auditLogs: {
type: new GraphQLList(AuditLogType),
args,
resolve
}
}
export default query
@@ -1,23 +0,0 @@
import {
GraphQLList
} from 'graphql'
import { ExchangeType } from '../types'
import { Exchange } from '../../models'
import logger from '../../config/logger'
const args = {}
const resolve = (parent, args, context) => {
logger.debug('exchanges -> Entering Fuction.')
return Exchange
}
const query = {
exchanges: {
type: new GraphQLList(ExchangeType),
args,
resolve
}
}
export default query
@@ -0,0 +1,50 @@
import {
GraphQLList
} from 'graphql'
import {
AuthentificationError
} from '../../errors'
import { CloneType } from '../types'
import { Clone } from '../../models'
import logger from '../../config/logger'
import getKuberneteClonePodStatus from '../../kubernetes/getClonePodStatus'
import getKuberneteClonePodLogs from '../../kubernetes/getClonePodLogs'
import teams_FbByTeamMember from '../../graphQLCalls/teams_FbByTeamMember'
import cloneDetails from './cloneDetails'
const args = {}
const resolve = async(parent, args, context) => {
logger.debug('History Clones -> Entering Fuction.')
if (!context.userId) {
throw new AuthentificationError()
}
let clones = await Clone.find({
authId: context.userId,
active: false
})
// TODO Refactor this code once financial beings api is ready
// Authorization is handled by the teams module
let botsByUser = await teams_FbByTeamMember(context.authorization)
for (var i = 0; i < clones.length; i++) {
clones[i] = await cloneDetails(context.authorization, botsByUser, clones[i])
}
return clones
}
const query = {
historyClones: {
type: new GraphQLList(CloneType),
args,
resolve
}
}
export default query
+24 -7
View File
@@ -3,31 +3,48 @@ import {
} from 'graphql'
import {
AuthentificationError
AuthentificationError,
OperationsError
} from '../../errors'
import { CloneType } from '../types'
import { Clone } from '../../models'
import logger from '../../config/logger'
import getKuberneteClonePodStatus from '../../kubernetes/getClonePodStatus'
import getKuberneteClonePodLogs from '../../kubernetes/getClonePodLogs'
import getCloneStatus from '../../kubernetes/getClonePodStatus'
import getCloneLogs from '../../kubernetes/getClonePodLogs'
import teams_FbByTeamMember from '../../graphQLCalls/teams_FbByTeamMember'
import cloneDetails from './cloneDetails'
const args = {}
const resolve = async(parent, args, context) => {
logger.debug('List Clones -> Entering Fuction.')
try{
if (!context.userId) {
throw new AuthentificationError()
}
let clones = await Clone.find({authId: context.userId})
let clones = await Clone.find({
authId: context.userId,
active: true
})
// TODO Refactor this code once financial beings api is ready
// Authorization is handled by the teams module
let botsByUser = await teams_FbByTeamMember(context.authorization)
for (var i = 0; i < clones.length; i++) {
clones[i].state = await getKuberneteClonePodStatus(clones[i]._id)
clones[i].lastLogs = await getKuberneteClonePodLogs(clones[i]._id)
clones[i] = await cloneDetails(context.authorization, botsByUser, clones[i])
let state = await getCloneStatus(clones[i].cloneName)
clones[i].state = state.substring(1, state.length-1)
let lastLogs = await getCloneLogs(clones[i].cloneName)
clones[i].lastLogs = lastLogs.substring(1, lastLogs.length-1)
}
return clones
} catch (err){
logger.error('List Clones error: %s', err.stack)
throw new OperationsError('There has been an error listing the clones.')
}
}
const query = {
+21
View File
@@ -0,0 +1,21 @@
import logger from '../../config/logger'
import { getJobNameFromClone, getSelectedBot } from '../../config/utils'
import teamAvatar from '../../graphQLCalls/teamAvatar'
const cloneDetails = async(authorization, botsByUser, clone) => {
logger.debug('Retrieving clone details.')
// TODO Refactor this code once financial beings api is ready
let selectedBot = getSelectedBot(botsByUser.data.data.teams_FbByTeamMember, clone.botId)
clone.cloneName = getJobNameFromClone(botsByUser.data.data.teams_FbByTeamMember.slug, selectedBot.slug, clone.mode)
clone.kind = selectedBot.kind
clone.teamName = botsByUser.data.data.teams_FbByTeamMember.name
clone.botName = selectedBot.name
clone.botAvatar = selectedBot.avatar
let team = await teamAvatar(authorization, botsByUser.data.data.teams_FbByTeamMember.id)
clone.teamAvatar = team.data.data.teams_TeamById.profile.avatar
logger.debug('Retrieving clone details complete.')
return clone
};
export default cloneDetails
+3 -1
View File
@@ -3,11 +3,13 @@ import {
} from 'graphql'
import ListClones from './ListClones'
import HistoryClones from './HistoryClones'
const RootQuery = new GraphQLObjectType({
name: 'RootQueryType',
fields: Object.assign(
ListClones
ListClones,
HistoryClones
)
})
+16 -2
View File
@@ -3,7 +3,8 @@ import {
GraphQLString,
GraphQLInt,
GraphQLBoolean,
GraphQLID
GraphQLID,
GraphQLFloat
} from 'graphql'
const CloneType = new GraphQLObjectType({
@@ -22,7 +23,20 @@ const CloneType = new GraphQLObjectType({
stateDatetime: {type: GraphQLInt},
createDatetime: {type: GraphQLInt},
lastLogs: {type: GraphQLString},
runAsTeam: {type: GraphQLBoolean}
runAsTeam: {type: GraphQLBoolean},
summaryDate: {type: GraphQLInt},
buyAverage: {type: GraphQLFloat},
sellAverage: {type: GraphQLFloat},
marketRate: {type: GraphQLFloat},
combinedProfitsA: {type: GraphQLFloat},
combinedProfitsB: {type: GraphQLFloat},
assetA: {type: GraphQLString},
assetB: {type: GraphQLString},
kind: {type: GraphQLString},
teamName: {type: GraphQLString},
botName: {type: GraphQLString},
botAvatar: {type: GraphQLString},
teamAvatar: {type: GraphQLString}
})
})
export default CloneType
+7 -2
View File
@@ -10,14 +10,19 @@ const Type = new GraphQLInputObjectType({
name: 'CloneInput',
description: 'Payload for clone input',
fields: () => ({
teamId: { type: new GraphQLNonNull(GraphQLString) },
botId: { type: new GraphQLNonNull(GraphQLString) },
mode: { type: GraphQLString },
resumeExecution: { type: GraphQLBoolean },
beginDatetime: { type: GraphQLInt },
endDatetime: { type: GraphQLInt },
waitTime: { type: GraphQLInt },
runAsTeam: { type: GraphQLBoolean }
runAsTeam: { type: GraphQLBoolean },
startYear: { type: GraphQLInt },
endYear: { type: GraphQLInt },
month: { type: GraphQLInt },
interval: { type: GraphQLInt },
processName: { type: GraphQLString },
kind: { type: GraphQLString }
})
});
+1 -1
View File
@@ -1,4 +1,4 @@
import CloneInputType from './Clone';
import CloneInputType from './Clone'
export {
CloneInputType