Commit 7cea5122 authored by Ahmad Nemati's avatar Ahmad Nemati

git pull

parent aa04dd56
const Sequelize = require('sequelize');
const sequelize = new Sequelize('ai', 'root', 'mahan7797', {
define: {
charset: 'utf8',
collate: 'utf8_general_ci'
},
host: 'db.zignaly.xyz',
dialect: 'mysql',
logging: false,
operatorsAliases: false
});
const Account = sequelize.define('account', {
name: Sequelize.STRING,
equity: {type: Sequelize.DOUBLE, allowNull: false, defaultValue: 0},
qty: {type: Sequelize.DOUBLE, allowNull: false, defaultValue: 0.001},
active: {type: Sequelize.BOOLEAN, allowNull: false, defaultValue: false},
testnet: {type: Sequelize.BOOLEAN, allowNull: false, defaultValue: false},
key: Sequelize.STRING,
secret: Sequelize.STRING,
});
async function getAllAccounts() {
return await Account.findAll({
raw: true
})
}
sequelize.sync()
module.exports = {
getAllAccounts:getAllAccounts
};
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
"npm": "^8.10.0", "npm": "^8.10.0",
"redis": "^4.1.0", "redis": "^4.1.0",
"request": "^2.88.2", "request": "^2.88.2",
"sequelize": "^6.21.3",
"mysql2": "^1.6.1",
"shelljs": "^0.8.4", "shelljs": "^0.8.4",
"stringify-object": "^4.0.1", "stringify-object": "^4.0.1",
"uniqid": "^5.4.0", "uniqid": "^5.4.0",
......
let db=require('./db')
test()
async function test()
{
let d=await db.getAllAccounts()
console.log(d)
}
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment