Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MohanVashist1 committed Apr 12, 2020
1 parent 6941b6f commit 45f154c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
16 changes: 12 additions & 4 deletions backend/lib/DataHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,18 @@ def retrieveCryptoData(self, symbol, kline_size):
return pd.read_csv(filename)

def retrieveCryptoDataLive(self, symbol, kline_size, minDate, maxDate):
updatedMinDate = datetime.strptime(
minDate, '%Y-%m-%d %H:%M:%S').strftime('%d %b %Y %H:%M:%S')
updatedMaxDate = datetime.strptime(
maxDate, '%Y-%m-%d %H:%M:%S').strftime('%d %b %Y %H:%M:%S')
if(":" in minDate):
updatedMinDate = datetime.strptime(
minDate, '%Y-%m-%d %H:%M:%S').strftime('%d %b %Y %H:%M:%S')
else:
updatedMinDate = datetime.strptime(
minDate, '%Y-%m-%d').strftime('%d %b %Y') + " 00:00:00"
if(":" in minDate):
updatedMaxDate = datetime.strptime(
maxDate, '%Y-%m-%d %H:%M:%S').strftime('%d %b %Y') + " 00:00:00"
else:
updatedMinDate = datetime.strptime(
minDate, '%Y-%m-%d').strftime('%d %b %Y %H:%M:%S')
klines = self.binance_client.get_historical_klines(
symbol, kline_size, updatedMinDate, updatedMaxDate, limit=1000)
data = pd.DataFrame(klines, columns=['timestamp', 'open', 'high', 'low', 'close',
Expand Down
2 changes: 1 addition & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CryptoRequest(BaseModel):


app = FastAPI()
app.add_middleware(HTTPSRedirectMiddleware)
# app.add_middleware(HTTPSRedirectMiddleware)
dataHandler = DataHandler.BinanceWrapper()
tempCryptoList = dataHandler.getcryptoSymbols()
cryptoList = []
Expand Down
20 changes: 14 additions & 6 deletions frontend/cryptoviz/src/js/components/CryptoLanding.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { useHistory } from "react-router-dom";
import Loader from "react-loader-spinner";
import { AuthContext } from "./App";
import { updateUser } from "../api";
import Cookie from 'js-cookie';
import Cookie from "js-cookie";
import { UPDATE_USER_SUCCESS, UPDATE_USER_FAILURE } from "../constants/auth";

const d = new Date();
Expand Down Expand Up @@ -203,8 +203,12 @@ function CryptoLanding({ match }) {

return (
<div>
{(Cookie.get('isLoggedIn') && Cookie.get('isLoggedIn').toLocaleLowerCase() === 'true' && authState.isAuthenticated) ||
((!Cookie.get('isLoggedIn') || Cookie.get('isLoggedIn').toLocaleLowerCase() === 'false') && !authState.isAuthenticated) ? (
{(Cookie.get("isLoggedIn") &&
Cookie.get("isLoggedIn").toLocaleLowerCase() === "true" &&
authState.isAuthenticated) ||
((!Cookie.get("isLoggedIn") ||
Cookie.get("isLoggedIn").toLocaleLowerCase() === "false") &&
!authState.isAuthenticated) ? (
<div>
<Navbar />
<div style={{ textAlign: "center", marginTop: "4em" }}>
Expand Down Expand Up @@ -240,7 +244,11 @@ function CryptoLanding({ match }) {
role="group"
aria-label="Button group with nested dropdown"
>
<button type="button" style={{cursor: "auto"}} className="btn btn-primary">
<button
type="button"
style={{ cursor: "auto" }}
className="btn btn-primary"
>
Select Time Interval
</button>
<div className="btn-group" role="group">
Expand Down Expand Up @@ -357,7 +365,7 @@ function CryptoLanding({ match }) {
<a
className="dropdown-item"
onClick={() => {
setminDate("2020-00-00");
setminDate("2020-01-00");
setmaxDate(currDate + " " + currTime);
setTimeInterval("1w");
}}
Expand All @@ -367,7 +375,7 @@ function CryptoLanding({ match }) {
<a
className="dropdown-item"
onClick={() => {
setminDate("2019-00-01");
setminDate("2019-01-01");
setmaxDate(currDate + " " + currTime);
setTimeInterval("1M");
}}
Expand Down

0 comments on commit 45f154c

Please sign in to comment.