Skip to content

Commit 9691934

Browse files
authored
Merge pull request #1 from pseudocode88/develop
Develop
2 parents 9b2d716 + 5ac2a05 commit 9691934

18 files changed

+1120
-129
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
2-
out/
2+
out/
3+
*.db

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ $ yarn install
1111
$ yarn run start
1212
1313
# To build the app
14-
$ yarn run build
14+
$ yarn run ship
1515
```
1616

1717
### Version v1.0
1818
- Simple position size calculator shows the risk and margin
19-
- Simple trading account setup with the capital and min-max risk
19+
- Simple trading account setup with the capital and min-max risk
20+
21+
### Version v2.0
22+
- Improved the look and feel of the tool
23+
- Position Size suggestion based on stop loss and risk per trade range
24+
- Persist account settings data

assets/logo-1000.png

45.8 KB
Loading

assets/logo.icns

36.8 KB
Binary file not shown.

assets/logo.png

35.2 KB
Loading

build.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
const fs = require('fs');
2+
const { exec } = require('child_process');
3+
const path = require('path');
4+
5+
const dbFolderPath = path.join(__dirname, 'db');
6+
const fileNames = ['account-settings.db']; // Add more file names as needed
7+
8+
// Step one: Delete and recreate the files
9+
function deleteAndRecreateFiles() {
10+
return new Promise((resolve, reject) => {
11+
const deletePromises = fileNames.map((fileName) => {
12+
const filePath = path.join(dbFolderPath, fileName);
13+
14+
return new Promise((resolve, reject) => {
15+
fs.unlink(filePath, (err) => {
16+
if (err && !fs.existsSync(filePath)) {
17+
console.error('Error deleting file:', err);
18+
reject(err);
19+
return;
20+
}
21+
fs.writeFile(filePath, '', (err) => {
22+
if (err) {
23+
console.error('Error recreating file:', err);
24+
reject(err);
25+
return;
26+
}
27+
console.log('Recreated file:', filePath);
28+
resolve();
29+
});
30+
});
31+
});
32+
});
33+
34+
Promise.all(deletePromises)
35+
.then(() => {
36+
resolve();
37+
})
38+
.catch((error) => {
39+
reject(error);
40+
});
41+
});
42+
}
43+
44+
// Step two: Run 'yarn run build' script
45+
function runBuildScript() {
46+
return new Promise((resolve, reject) => {
47+
exec('yarn run build', (error, stdout, stderr) => {
48+
if (error) {
49+
console.error(`Error executing 'yarn run build' command: ${error.message}`);
50+
reject(error);
51+
return;
52+
}
53+
if (stderr) {
54+
console.error(`Command error: ${stderr}`);
55+
reject(stderr);
56+
return;
57+
}
58+
console.log(`Command output: ${stdout}`);
59+
resolve();
60+
});
61+
});
62+
}
63+
64+
// Execute the steps sequentially
65+
deleteAndRecreateFiles()
66+
.then(() => runBuildScript())
67+
.then(() => {
68+
console.log('Build script completed successfully.');
69+
})
70+
.catch((error) => {
71+
console.error('Error encountered:', error);
72+
});

calc.js

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)