stupid fucking ts

This commit is contained in:
artin 2023-07-25 23:22:12 +00:00
parent 2fa792c360
commit cc6a8852de

View File

@ -205,7 +205,7 @@ async function order(acct_id, api_key, instrument, quantity) {
}
data = {
let data = {
"order": {
/*"trailingStopLossOnFill": {
"timeInForce": "GTC",
@ -342,7 +342,7 @@ async function takeProfit(acct_id, api_key, tradeID, dist) {
app.get('/closeAll', async (req, res) => {
for (account of Object.keys(accounts)) {
for (const account of Object.keys(accounts)) {
let trades = await getTrades(accounts[account]['ACCT'], accounts[account]['APIKEY'])
for (const t of trades.data['trades']) {
await closeOrder(accounts[account]['ACCT'], accounts[account]['APIKEY'], t['id'])
@ -356,7 +356,7 @@ app.get('/closeAll', async (req, res) => {
app.get('/tradesData', async (req, res) => {
let r = [];
for (account of Object.keys(accounts)) {
for (const account of Object.keys(accounts)) {
let response = await getTrades(accounts[account]['ACCT'], accounts[account]['APIKEY'])
try {
//Object.(response.data['trades']).forEach(([a, t]) =>{
@ -393,7 +393,7 @@ app.get('/transactionsAll/:account', async (req, res) => {
app.get('/transactions', async (req, res) => {
let r = {}
for (account of Object.keys(accounts)) {
for (const account of Object.keys(accounts)) {
let response = await getTransactions(account, accounts[account]['ACCT'], accounts[account]['APIKEY'])
try {
r = {};
@ -408,7 +408,7 @@ app.get('/transactions', async (req, res) => {
app.get('/trades', async (req, res) => {
let r = {}
for (account of Object.keys(accounts)) {
for (const account of Object.keys(accounts)) {
let response = await getTrades(accounts[account]['ACCT'], accounts[account]['APIKEY'])
try {
r[account] = response.data;
@ -485,12 +485,12 @@ app.get('/state', async (req, res) => {
})
app.get('/order/:instrument/:quantity', async (req, res) => {
r = {};
for (account of Object.keys(accounts)) {
td = await getTradesByInstrument(accounts[account]['ACCT'], accounts[account]['APIKEY'], req.params.instrument);
let r = {};
for (const account of Object.keys(accounts)) {
let td = await getTradesByInstrument(accounts[account]['ACCT'], accounts[account]['APIKEY'], req.params.instrument);
if (td == null || (td['state'] != "OPEN" && td['state'] != "PENDING")) {
response = await order(accounts[account]['ACCT'], accounts[account]['APIKEY'], req.params.instrument, req.params.quantity);
let response = await order(accounts[account]['ACCT'], accounts[account]['APIKEY'], req.params.instrument, req.params.quantity);
console.log(response["data"]);
if (typeof(response["data"]["orderFillTransaction"]) !== "undefined") {
let delta = 0.0012;
@ -552,4 +552,4 @@ try {
setTimeout(myFunc, 1500, 'funky');
setTimeout(processTP, 1500 );