Skip to content

Commit

Permalink
gRPC Correction on Frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Wilson committed Apr 5, 2023
1 parent 0db8f34 commit 6134dc3
Show file tree
Hide file tree
Showing 22 changed files with 434 additions and 434 deletions.
454 changes: 227 additions & 227 deletions frontend/clients/DayTraderClient.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions frontend/pages/api/log/summary.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// import { DisplaySummary } from "../../../clients/DayTraderClient";
import { DisplaySummary } from "../../../clients/DayTraderClient";

export default async function userSummary(req, res){
const user = req.body.username;
// const response = await DisplaySummary(user, -1);
const response = {
user_commands: [],
account_transactions: [],
}
const response = await DisplaySummary(user, -1);
// const response = {
// user_commands: [],
// account_transactions: [],
// }
return res.status(200).json(response)
}
12 changes: 6 additions & 6 deletions frontend/pages/api/log/system.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// import { DumpLog } from "../../../clients/DayTraderClient";
import { DumpLog } from "../../../clients/DayTraderClient";


export default async function dumplog(req, res){
// const response = await DumpLog("dumplog.xml", -1);
const response = {
xml: "",
success: true,
}
const response = await DumpLog("dumplog.xml", -1);
// const response = {
// xml: "",
// success: true,
// }
return res.status(200).json(response)
}
12 changes: 6 additions & 6 deletions frontend/pages/api/log/user.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// import { DumpLogUser } from "../../../clients/DayTraderClient";
import { DumpLogUser } from "../../../clients/DayTraderClient";

export default async function userLog(req, res){
const user = req.body.username;
// const response = await DumpLogUser(user, "dumploguser.xml", -1);
const response = {
xml: "",
success: true,
}
const response = await DumpLogUser(user, "dumploguser.xml", -1);
// const response = {
// xml: "",
// success: true,
// }
return res.status(200).json(response)
}
10 changes: 5 additions & 5 deletions frontend/pages/api/stocks/[id].js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// import { Quote } from "../../../clients/DayTraderClient";
import { Quote } from "../../../clients/DayTraderClient";

const stocks = {
"ABC": {
Expand Down Expand Up @@ -101,9 +101,9 @@ const stocks = {

export default async function getStocks(req, res){
const username = req.body.username;
const stock = req.query.id.toUpperCase()
const response = stocks[id] ? stocks[id] : {name: "NOTFOUND"}
// const stock = req.query.id.toLowerCase()
// const response = await Quote(username, stock, -1);
// const stock = req.query.id.toUpperCase()
// const response = stocks[id] ? stocks[id] : {name: "NOTFOUND"}
const stock = req.query.id.toLowerCase()
const response = await Quote(username, stock, -1);
return res.status(200).json(response)
}
10 changes: 5 additions & 5 deletions frontend/pages/api/stocks/buy/cancel.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// import { CancelBuy } from "../../../../clients/DayTraderClient";
import { CancelBuy } from "../../../../clients/DayTraderClient";

export default async function cancelBuy(req, res){
const username = req.body.username
// const response = await CancelBuy(username, -1);
const response = {
success: true,
}
const response = await CancelBuy(username, -1);
// const response = {
// success: true,
// }
return res.status(200).json(response)
}
10 changes: 5 additions & 5 deletions frontend/pages/api/stocks/buy/commit.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// import { CommitBuy } from "../../../../clients/DayTraderClient";
import { CommitBuy } from "../../../../clients/DayTraderClient";


export default async function commitBuy(req, res){
const username = req.body.username
// const response = await CommitBuy(username, -1);
const response = {
success: true,
}
const response = await CommitBuy(username, -1);
// const response = {
// success: true,
// }
return res.status(200).json(response)
}
10 changes: 5 additions & 5 deletions frontend/pages/api/stocks/buy/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// import { Buy } from "../../../../clients/DayTraderClient";
import { Buy } from "../../../../clients/DayTraderClient";

export default async function buy(req, res){
const username = req.body.username
const stock = req.body.stock
const amount = req.body.amount
// const response = await Buy(username, stock, amount, -1);
const response = {
success: true,
}
const response = await Buy(username, stock, amount, -1);
// const response = {
// success: true,
// }
return res.status(200).json(response)
}
10 changes: 5 additions & 5 deletions frontend/pages/api/stocks/buytrigger/cancel.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// import { CancelSetBuy } from "../../../../clients/DayTraderClient";
import { CancelSetBuy } from "../../../../clients/DayTraderClient";


export default async function cancelSetBuy(req, res){
const username = req.body.username;
const stock_symbol = req.body.stock;
// const response = await CancelSetBuy(username, stock_symbol, -1);
const response = {
success: true,
}
const response = await CancelSetBuy(username, stock_symbol, -1);
// const response = {
// success: true,
// }
return res.status(200).json(response)
}
10 changes: 5 additions & 5 deletions frontend/pages/api/stocks/buytrigger/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// import { SetBuyAmount } from "../../../../clients/DayTraderClient";
import { SetBuyAmount } from "../../../../clients/DayTraderClient";

export default async function setBuyAmount(req, res){
const username = req.body.username;
const stock_symbol = req.body.stock;
const amount = req.body.stock;
// const response = await SetBuyAmount(username, stock_symbol, amount, -1);
const response = {
success: true,
}
const response = await SetBuyAmount(username, stock_symbol, amount, -1);
// const response = {
// success: true,
// }
return res.status(200).json(response)
}
10 changes: 5 additions & 5 deletions frontend/pages/api/stocks/buytrigger/settrigger.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// import { SetBuyTrigger } from "../../../../clients/DayTraderClient";
import { SetBuyTrigger } from "../../../../clients/DayTraderClient";

export default async function setBuyTrigger(req, res){
const username = req.body.username;
const stock_symbol = req.body.stock;
const amount = req.body.amount;
// const response = await SetBuyTrigger(username, stock_symbol, amount, -1);
const response = {
success: true,
}
const response = await SetBuyTrigger(username, stock_symbol, amount, -1);
// const response = {
// success: true,
// }
return res.status(200).json(response)
}
Loading

0 comments on commit 6134dc3

Please sign in to comment.