Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
out/
out/
*.db
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ $ yarn install
$ yarn run start

# To build the app
$ yarn run build
$ yarn run ship
```

### Version v1.0
- Simple position size calculator shows the risk and margin
- Simple trading account setup with the capital and min-max risk
- Simple trading account setup with the capital and min-max risk

### Version v2.0
- Improved the look and feel of the tool
- Position Size suggestion based on stop loss and risk per trade range
- Persist account settings data
Binary file added assets/logo-1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo.icns
Binary file not shown.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
const fs = require('fs');
const { exec } = require('child_process');
const path = require('path');

const dbFolderPath = path.join(__dirname, 'db');
const fileNames = ['account-settings.db']; // Add more file names as needed

// Step one: Delete and recreate the files
function deleteAndRecreateFiles() {
return new Promise((resolve, reject) => {
const deletePromises = fileNames.map((fileName) => {
const filePath = path.join(dbFolderPath, fileName);

return new Promise((resolve, reject) => {
fs.unlink(filePath, (err) => {
if (err && !fs.existsSync(filePath)) {
console.error('Error deleting file:', err);
reject(err);
return;
}
fs.writeFile(filePath, '', (err) => {
if (err) {
console.error('Error recreating file:', err);
reject(err);
return;
}
console.log('Recreated file:', filePath);
resolve();
});
});
});
});

Promise.all(deletePromises)
.then(() => {
resolve();
})
.catch((error) => {
reject(error);
});
});
}

// Step two: Run 'yarn run build' script
function runBuildScript() {
return new Promise((resolve, reject) => {
exec('yarn run build', (error, stdout, stderr) => {
if (error) {
console.error(`Error executing 'yarn run build' command: ${error.message}`);
reject(error);
return;
}
if (stderr) {
console.error(`Command error: ${stderr}`);
reject(stderr);
return;
}
console.log(`Command output: ${stdout}`);
resolve();
});
});
}

// Execute the steps sequentially
deleteAndRecreateFiles()
.then(() => runBuildScript())
.then(() => {
console.log('Build script completed successfully.');
})
.catch((error) => {
console.error('Error encountered:', error);
});
57 changes: 0 additions & 57 deletions calc.js

This file was deleted.

Loading