Skip to content

Commit

Permalink
v.0.6.0: monorepo, workspaces, lerna
Browse files Browse the repository at this point in the history
  • Loading branch information
suenot committed May 6, 2019
1 parent d719cfd commit 8672eb9
Show file tree
Hide file tree
Showing 446 changed files with 138 additions and 89 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Kupi-terminal – crypto currency trading terminal

[![License](https://img.shields.io/badge/licence-GPL--2.0-blue.svg)](https://raw.githubusercontent.com/kupi-network/kupi-terminal/master/LICENSE) [![Discord](https://img.shields.io/discord/430374279343898624.svg?color=4D64BA&label=chat%20on%20discord)](https://discord.gg/2PtuMAg) ![Version](https://img.shields.io/badge/express_server-0.5.0-blue.svg) ![Version](https://img.shields.io/badge/react_client-0.5.0-blue.svg) ![Version](https://img.shields.io/badge/vue_client-0.1.6-blue.svg) [![codecov](https://codecov.io/gh/kupi-network/kupi-terminal/branch/master/graph/badge.svg)](https://codecov.io/gh/kupi-network/kupi-terminal) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a0b7b6b595fd4b3db3818fed7665b1bf)](https://www.codacy.com/app/suenot/kupi-terminal?utm_source=github.com&utm_medium=referral&utm_content=kupi-network/kupi-terminal&utm_campaign=Badge_Grade) [![Build Status](https://travis-ci.org/kupi-network/kupi-terminal.svg?branch=master)](https://travis-ci.org/kupi-network/kupi-terminal)
[![License](https://img.shields.io/badge/licence-GPL--2.0-blue.svg)](https://raw.githubusercontent.com/kupi-network/kupi-terminal/master/LICENSE) [![Discord](https://img.shields.io/discord/430374279343898624.svg?color=4D64BA&label=chat%20on%20discord)](https://discord.gg/2PtuMAg) ![Version](https://img.shields.io/badge/express_server-0.6.0-blue.svg) ![Version](https://img.shields.io/badge/react_client-0.6.0-blue.svg) ![Version](https://img.shields.io/badge/vue_client-0.2.0-blue.svg) [![codecov](https://codecov.io/gh/kupi-network/kupi-terminal/branch/master/graph/badge.svg)](https://codecov.io/gh/kupi-network/kupi-terminal) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a0b7b6b595fd4b3db3818fed7665b1bf)](https://www.codacy.com/app/suenot/kupi-terminal?utm_source=github.com&utm_medium=referral&utm_content=kupi-network/kupi-terminal&utm_campaign=Badge_Grade) [![Build Status](https://travis-ci.org/kupi-network/kupi-terminal.svg?branch=master)](https://travis-ci.org/kupi-network/kupi-terminal)

Open source, customized, extendable trading terminal that supports 130+ crypto stocks.

Expand Down
File renamed without changes.
48 changes: 39 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,62 @@
{
"name": "kupi",
"version": "0.5.0",
"productName": "Kupi",
"version": "0.7.0",
"private": true,
"scripts": {
"rm": "rm -rf ./node_modules yarn.lock package-lock.json && lerna exec -- rm -rf ./node_modules yarn.lock package-lock.json",
"start": "lerna run start --stream",
"react-server:start": "lerna run start --scope @kupi/express-server --scope @kupi/react-client",
"vue-server:start": "lerna run start --scope @kupi/express-server --scope @kupi/vue-client",
"test": "lerna run test --stream",
"update:version": "lerna version --no-push",
"server:start": "lerna run start --scope @kupi/express-server",
"server:docker": "lerna run docker --scope @kupi/express-server",
"server:test": "lerna run test --scope @kupi/express-server",
"react:start": "lerna run start --scope @kupi/react-client",
"react:docker": "lerna run docker --scope @kupi/react-client",
"react:build": "lerna run build --scope @kupi/react-client",
"react:test": "lerna run test --scope @kupi/react-client",
"vue:serve": "lerna run serve --scope @kupi/vue-client",
"vue:start": "lerna run start --scope @kupi/vue-client",
"vue:build": "lerna run build --scope @kupi/vue-client",
"vue:eb": "lerna run electron:build",
"vue:electron:build": "lerna run electron:build",
"vue:electron:generate-icons": "lerna run electron:generate-icons",
"vue:electron:serve": "lerna run electron:serve",
"vue:electron:start": "lerna run electron:start",
"vue:postinstall": "lerna run postinstall --scope @kupi/vue-client",
"vue:postuninstall": "lerna run postuninstall --scope @kupi/vue-client",
"vue:test:unit": "lerna run test:unit --scope @kupi/vue-client",
"vue:test": "lerna run test --scope @kupi/vue-client"
},
"dependencies": {
"codecov": "^3.2.0",
"istanbul": "^0.4.5",
"jest": "^24.3.1"
"jest": "^24.3.1",
"nodemon": "*",
"rimraf": "^2.6.3"
},
"devDependencies": {
"lerna": "^3.13.2"
},
"jest": {
"testPathIgnorePatterns": [
"/node_modules/",
"/react-client/node_modules/",
"/react-client/scripts/",
"/vue-client/node_modules/",
"/vue-client/",
"/server/node_modules/"
],
"coverageDirectory": "./coverage/",
"collectCoverage": true
},
"workspaces": {
"packages": [
"packages/*",
"packages/express-server/utils/*"
]
],
"nohoist": ["packages/vue-client"]
},
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"babel-jest": "^24.7.1"
}
"postcss": {}
}
1 change: 1 addition & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
### Folder for core components
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var fs = require('fs')
const uuidv1 = require('uuid/v1')
// PASSPORT
// const cookieSession = require('cookie-session')
Expand All @@ -7,18 +8,20 @@ const uuidv1 = require('uuid/v1')
// app.use(express.static(publicRoot))

const auth = function(app) {
// GET PRIVATE CONFIGS
try {
global.USERS = require('../../../private/auth.json').users
global.USERS = JSON.parse(fs.readFileSync('../../../../private/auth.json', 'utf8')).users
} catch(err) {
global.USERS = []
}

var serverSession
try {
serverSession = require('../../../private/auth.json').session
serverSession = JSON.parse(fs.readFileSync('../../../../private/auth.json', 'utf8')).session
} catch(err) {
serverSession = undefined
}
// END GET PRIVATE CONFIGS

if (serverSession === undefined) {
serverSession = {
"name": uuidv1(),
Expand Down Expand Up @@ -58,7 +61,7 @@ const auth = function(app) {
app.use(passport.initialize())
app.use(passport.session())
// try {
// global.USERS = require('../private/auth.json')
// global.USERS = require('../../private/auth.json')
// } catch(err) {
// global.USERS = []
// }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions packages/express-server/core_components/startMongo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
var MongoClient = require('mongodb').MongoClient
var localMongoUrl = ''
var {sleep} = require('@kupi/sleep')

// GET PRIVATE CONFIGS
var fs = require('fs')
try {
var mongoConf = JSON.parse(fs.readFileSync('../../../private/mongo.json', 'utf8')).mongo
} catch(err) {
var mongoConf = undefined
}
// END GET PRIVATE CONFIGS

const startMongo = async function() {
if (!mongoConf) return false

if (process.env.DOCKER === 'DOCKER') {
localMongoUrl = 'mongodb://'+mongoConf.username+':'+mongoConf.password+'@'+mongoConf.dockerHost+':'+'27017'+'/'+mongoConf.db+'?authSource=admin'
// console.log(localMongoUrl)
} else {
localMongoUrl = 'mongodb://'+mongoConf.username+':'+mongoConf.password+'@'+mongoConf.host+':'+mongoConf.port+'/'+mongoConf.db+'?authSource=admin'
// console.log(localMongoUrl)
}

while(true) {
try {
var db = await MongoClient.connect(localMongoUrl)
console.log('Connected to mongo')
return db
} catch (err) {
console.log("Can't connect to mongo")
}
await sleep(1000)
}
}

module.exports = startMongo
File renamed without changes.
File renamed without changes.
56 changes: 18 additions & 38 deletions server/index.js → packages/express-server/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
const express = require('express')
const app = express()
const api = require('./api/api')
const privateKeys = require('../private/keys.json')

// GET PRIVATE CONFIGS
var fs = require('fs')
try {
var privateKeys = JSON.parse(fs.readFileSync('../../private/keys.json', 'utf8'))
} catch(err) {
var privateKeys = []
}
// END GET PRIVATE CONFIGS

const bodyParser = require('body-parser')
app.use(bodyParser.json())
Expand Down Expand Up @@ -60,49 +68,22 @@ const main = async () => {
await initCCXT(privateKeys)
} catch(err) {
console.log(err)
// console.log('No ccxt keys, no problems')
console.log('No ccxt keys, no problems')
}
try {
await initEthplorer(privateKeys)
} catch(err) {
console.log('No ethplorer keys, no problems')
}
// console.log(global.ACCOUNTS)
// console.log(global.CCXT)



try { await initBalance() } catch(err) { console.log(err) }
// получение публичных данных с сервера
try { await updateCoinmarketcap() } catch(err) { console.log(err) }
// try { updateCoinmarketcapCycle(60000) } catch(err) { console.log(err) }

// // получение приватных данных с бирж

// SAFE
// balance


try { updateBalance(20*60*1000) } catch(err) { console.log(err) }


// console.log(await getMyTrades('ID_Binance_2', 'ETH/BTC') ) // тестовое получение трэйдов

// KUPI_API | SAFE & PUBLIC
// console.log(await getPairs('binance'))
// console.log(await getTrades('binance', 'ETH_BTC'))
// console.log(await getStocks())
// console.log(await updateCoinmarketcap())
// console.log(await getOrderBook('binance', 'ETH_BTC'))
// console.log(await getOHLCV('binance', 'ETH_BTC', '3m'))


// NOT-SAFE
try { openOrders(90000) } catch(err) { console.log(err) }


// try { await fetchDeposit('binance', 'ETH') } catch(err) { console.log(err) }

if (global.MONGO) {
try { await initBalance() } catch(err) { console.log(err) }
// получение публичных данных с сервера
try { await updateCoinmarketcap() } catch(err) { console.log(err) }
// try { updateCoinmarketcapCycle(60000) } catch(err) { console.log(err) }
try { updateBalance(20*60*1000) } catch(err) { console.log(err) }
try { openOrders(90000) } catch(err) { console.log(err) }
}

app.use('/user-api/', api)
// app.use('/user-api/auth/', authApi)
Expand All @@ -129,7 +110,6 @@ if (process.env.QUEUE_LOG === 'TRUE') {
}, 1000)
}


var port = process.env.DOCKER === 'DOCKER' ? '0.0.0.0' : '127.0.0.1'
app.listen(8040, port, () => {
console.log('KUPI termintal launched on 8040 port')
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions server/package.json → packages/express-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kupi-terminal-express",
"version": "0.5.0",
"name": "@kupi/express-server",
"version": "0.6.0",
"private": true,
"dependencies": {
"assert": "^1.4.1",
Expand Down Expand Up @@ -30,8 +30,8 @@
"@kupi/calculateCoin": "*"
},
"scripts": {
"start": "./node_modules/nodemon/bin/nodemon.js index.js",
"docker": "DOCKER=DOCKER ./node_modules/nodemon/bin/nodemon.js index.js",
"start": "../../node_modules/nodemon/bin/nodemon.js index.js",
"docker": "DOCKER=DOCKER ../../node_modules/nodemon/bin/nodemon.js index.js",
"test": "jest --watch"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion server/test/api.js → packages/express-server/test/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const privateKeys = require('../../private/keys.json').keys.binance
const ccxt = require ('ccxt')
// var catchHead = require('../../utils').catchHead

Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions packages/express-server/user_components/api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const express = require('express')
var router = express.Router()

router.get('/some/', async function (req, res) {
try {
res.json('some')
} catch (err) {}
})

module.exports = router
5 changes: 5 additions & 0 deletions packages/express-server/user_components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const userComponents = async () => {
// console.log('user_components')
}

module.exports = userComponents
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kupi-terminal-react",
"version": "0.5.0",
"name": "@kupi/react-client",
"version": "0.6.0",
"private": true,
"dependencies": {
"@babel/core": "7.1.0",
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/user/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
### Folder for user components (private)
1 change: 1 addition & 0 deletions packages/utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
### Folder for utils components
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 8672eb9

Please sign in to comment.