clean code
This commit is contained in:
parent
65e1066b45
commit
1c7d6950a4
@ -34,7 +34,7 @@ async function updateSentiment(sentiment:string) {
|
|||||||
const response = await fetch('/api/community-sentiment', {
|
const response = await fetch('/api/community-sentiment', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json","X-API-KEY": apiKey
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData),
|
body: JSON.stringify(postData),
|
||||||
}); // make a POST request to the server with the FormData object
|
}); // make a POST request to the server with the FormData object
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { stockTicker, etfTicker, assetType, screenWidth } from '$lib/store';
|
import { stockTicker, etfTicker, assetType, screenWidth } from '$lib/store';
|
||||||
import { abbreviateNumber, formatString } from '$lib/utils';
|
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
import Lazy from 'svelte-lazy';
|
import Lazy from 'svelte-lazy';
|
||||||
|
|
||||||
export let correlationList;
|
export let correlationList;
|
||||||
|
|
||||||
let charNumber = 20;
|
|
||||||
let showFullStats = false;
|
let showFullStats = false;
|
||||||
|
|
||||||
|
|
||||||
@ -38,16 +36,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$: {
|
$: charNumber = $screenWidth < 640 ? 10 : 20;
|
||||||
if ($screenWidth < 640)
|
|
||||||
{
|
|
||||||
charNumber = 10;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
charNumber = 20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,28 +1,13 @@
|
|||||||
<script lang ='ts'>
|
<script lang ='ts'>
|
||||||
import { darkPoolComponent, displayCompanyName, stockTicker, assetType, etfTicker, screenWidth, userRegion, getCache, setCache} from '$lib/store';
|
import { darkPoolComponent, displayCompanyName, stockTicker, assetType, etfTicker, screenWidth, getCache, setCache} from '$lib/store';
|
||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
import { Chart } from 'svelte-echarts'
|
import { Chart } from 'svelte-echarts'
|
||||||
import { abbreviateNumber, formatDateRange } from "$lib/utils";
|
import { abbreviateNumber, formatDateRange } from "$lib/utils";
|
||||||
|
|
||||||
import Lazy from 'svelte-lazy';
|
import Lazy from 'svelte-lazy';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
let isLoaded = false;
|
let isLoaded = false;
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
let rawData = [];
|
let rawData = [];
|
||||||
let optionsData;
|
let optionsData;
|
||||||
@ -183,10 +168,10 @@ const getDarkPool = async (ticker) => {
|
|||||||
|
|
||||||
const postData = {'ticker': ticker};
|
const postData = {'ticker': ticker};
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/dark-pool', {
|
const response = await fetch(data?.apiURL + '/dark-pool', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,29 +1,13 @@
|
|||||||
|
|
||||||
<script lang ='ts'>
|
<script lang ='ts'>
|
||||||
import { enterpriseComponent, displayCompanyName, stockTicker, screenWidth, userRegion, getCache, setCache} from '$lib/store';
|
import { enterpriseComponent, displayCompanyName, stockTicker, screenWidth, getCache, setCache} from '$lib/store';
|
||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
import { Chart } from 'svelte-echarts'
|
import { Chart } from 'svelte-echarts';
|
||||||
|
|
||||||
import Lazy from 'svelte-lazy';
|
import Lazy from 'svelte-lazy';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
let isLoaded = false;
|
let isLoaded = false;
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
let rawData = [];
|
let rawData = [];
|
||||||
let optionsData;
|
let optionsData;
|
||||||
@ -143,10 +127,10 @@ const getEnterPriseValues = async (ticker) => {
|
|||||||
|
|
||||||
const postData = {'ticker': ticker};
|
const postData = {'ticker': ticker};
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/enterprise-values', {
|
const response = await fetch(data?.apiURL + '/enterprise-values', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,24 +1,10 @@
|
|||||||
|
|
||||||
<script lang ='ts'>
|
<script lang ='ts'>
|
||||||
import { fundamentalAnalysisComponent, displayCompanyName, stockTicker, userRegion, getCache, setCache} from '$lib/store';
|
import { fundamentalAnalysisComponent, displayCompanyName, stockTicker, getCache, setCache} from '$lib/store';
|
||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
|
|
||||||
let fundamentalAnalysisDict = {};
|
let fundamentalAnalysisDict = {};
|
||||||
let isLoaded = false;
|
let isLoaded = false;
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
@ -40,10 +26,10 @@ const getFundamentalAnalysis = async (ticker) => {
|
|||||||
|
|
||||||
const postData = {'ticker': ticker};
|
const postData = {'ticker': ticker};
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/fundamental-predictor-analysis', {
|
const response = await fetch(data?.apiURL + '/fundamental-predictor-analysis', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,28 +1,14 @@
|
|||||||
<script lang ='ts'>
|
<script lang ='ts'>
|
||||||
import { impliedVolatilityComponent, displayCompanyName, stockTicker, assetType, etfTicker, screenWidth, userRegion, getCache, setCache} from '$lib/store';
|
import { impliedVolatilityComponent, displayCompanyName, stockTicker, assetType, etfTicker, screenWidth, getCache, setCache} from '$lib/store';
|
||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
import { Chart } from 'svelte-echarts'
|
import { Chart } from 'svelte-echarts'
|
||||||
import { formatDateRange } from "$lib/utils";
|
import { formatDateRange } from "$lib/utils";
|
||||||
|
|
||||||
import Lazy from 'svelte-lazy';
|
import Lazy from 'svelte-lazy';
|
||||||
|
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
let isLoaded = false;
|
let isLoaded = false;
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
let rawData = [];
|
let rawData = [];
|
||||||
let optionsData;
|
let optionsData;
|
||||||
@ -220,10 +206,10 @@ function findLowestAndhighestIV(data, lastDateStr) {
|
|||||||
|
|
||||||
const postData = {'ticker': ticker};
|
const postData = {'ticker': ticker};
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/implied-volatility', {
|
const response = await fetch(data?.apiURL + '/implied-volatility', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<script lang ='ts'>
|
<script lang ='ts'>
|
||||||
import { marketMakerComponent, displayCompanyName, stockTicker, assetType, etfTicker, screenWidth, userRegion, getCache, setCache} from '$lib/store';
|
import { marketMakerComponent, displayCompanyName, stockTicker, assetType, etfTicker, screenWidth, getCache, setCache} from '$lib/store';
|
||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
import { Chart } from 'svelte-echarts'
|
import { Chart } from 'svelte-echarts'
|
||||||
import { abbreviateNumber, formatString, formatDateRange } from "$lib/utils";
|
import { abbreviateNumber, formatString, formatDateRange } from "$lib/utils";
|
||||||
@ -8,22 +8,7 @@
|
|||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
let isLoaded = false;
|
let isLoaded = false;
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
||||||
|
|
||||||
let rawData = {};
|
let rawData = {};
|
||||||
let historyData = [];
|
let historyData = [];
|
||||||
@ -168,10 +153,10 @@ const getMarketMaker = async (ticker) => {
|
|||||||
|
|
||||||
const postData = {'ticker': ticker};
|
const postData = {'ticker': ticker};
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/market-maker', {
|
const response = await fetch(data?.apiURL + '/market-maker', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,25 +1,11 @@
|
|||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
import { optionComponent, assetType, stockTicker, etfTicker, displayCompanyName, userRegion, getCache, setCache} from "$lib/store";
|
import { optionComponent, assetType, stockTicker, etfTicker, displayCompanyName, getCache, setCache} from "$lib/store";
|
||||||
import { abbreviateNumber } from "$lib/utils";
|
import { abbreviateNumber } from "$lib/utils";
|
||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
import { LayerCake, Html } from 'layercake';
|
import { LayerCake, Html } from 'layercake';
|
||||||
import Circle from '$lib/components/Circle/Circle.html.svelte';
|
import Circle from '$lib/components/Circle/Circle.html.svelte';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let optionsDict = {};
|
let optionsDict = {};
|
||||||
|
|
||||||
@ -58,10 +44,10 @@ const getOptionsBubble = async (ticker) => {
|
|||||||
|
|
||||||
const postData = {'ticker': ticker};
|
const postData = {'ticker': ticker};
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/options-bubble', {
|
const response = await fetch(data?.apiURL + '/options-bubble', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,27 +2,12 @@
|
|||||||
import { optionsNetFlowComponent, displayCompanyName, stockTicker, assetType, etfTicker, screenWidth, userRegion, getCache, setCache} from '$lib/store';
|
import { optionsNetFlowComponent, displayCompanyName, stockTicker, assetType, etfTicker, screenWidth, userRegion, getCache, setCache} from '$lib/store';
|
||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
import { Chart } from 'svelte-echarts'
|
import { Chart } from 'svelte-echarts'
|
||||||
import { abbreviateNumber, formatString } from "$lib/utils";
|
|
||||||
|
|
||||||
import Lazy from 'svelte-lazy';
|
import Lazy from 'svelte-lazy';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
let isLoaded = false;
|
let isLoaded = false;
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
let rawData = [];
|
let rawData = [];
|
||||||
let optionsData;
|
let optionsData;
|
||||||
@ -175,10 +160,10 @@ let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|||||||
|
|
||||||
const postData = {'ticker': ticker};
|
const postData = {'ticker': ticker};
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/options-net-flow-ticker', {
|
const response = await fetch(data?.apiURL + '/options-net-flow-ticker', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,30 +1,17 @@
|
|||||||
|
|
||||||
<script lang ='ts'>
|
<script lang ='ts'>
|
||||||
import { priceAnalysisComponent, displayCompanyName, stockTicker, etfTicker, cryptoTicker, assetType, screenWidth, userRegion, getCache, setCache} from '$lib/store';
|
import { priceAnalysisComponent, displayCompanyName, stockTicker, etfTicker, cryptoTicker, assetType, screenWidth, getCache, setCache} from '$lib/store';
|
||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
import { Chart } from 'svelte-echarts'
|
import { Chart } from 'svelte-echarts'
|
||||||
|
import Lazy from 'svelte-lazy';
|
||||||
|
|
||||||
|
export let data;
|
||||||
|
|
||||||
let isLoaded = false;
|
let isLoaded = false;
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
import Lazy from 'svelte-lazy';
|
|
||||||
|
|
||||||
|
|
||||||
let priceAnalysisDict = {};
|
let priceAnalysisDict = {};
|
||||||
export let data;
|
|
||||||
|
|
||||||
const modalContent = `
|
const modalContent = `
|
||||||
Our AI model, employing a Bayesian approach, predicts future prices by breaking down trends, seasonality, and holiday effects. It integrates uncertainty to offer forecasts with intervals.<br><br>
|
Our AI model, employing a Bayesian approach, predicts future prices by breaking down trends, seasonality, and holiday effects. It integrates uncertainty to offer forecasts with intervals.<br><br>
|
||||||
@ -148,10 +135,10 @@ const getPriceAnalysis = async (ticker) => {
|
|||||||
|
|
||||||
const postData = {'ticker': ticker};
|
const postData = {'ticker': ticker};
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/price-analysis', {
|
const response = await fetch(data?.apiURL + '/price-analysis', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,34 +1,18 @@
|
|||||||
|
|
||||||
<script lang ='ts'>
|
<script lang ='ts'>
|
||||||
import { retailVolumeComponent,displayCompanyName, stockTicker, assetType, etfTicker, screenWidth, userRegion, getCache, setCache} from '$lib/store';
|
import { retailVolumeComponent,displayCompanyName, stockTicker, assetType, etfTicker, screenWidth, getCache, setCache} from '$lib/store';
|
||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
import { Chart } from 'svelte-echarts'
|
import { Chart } from 'svelte-echarts'
|
||||||
import { abbreviateNumber, formatDateRange } from "$lib/utils";
|
import { abbreviateNumber, formatDateRange } from "$lib/utils";
|
||||||
|
|
||||||
import Lazy from 'svelte-lazy';
|
import Lazy from 'svelte-lazy';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let isLoaded = false;
|
let isLoaded = false;
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let historyData = [];
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||||
|
|
||||||
|
let historyData = []
|
||||||
let rawData = [];
|
let rawData = [];
|
||||||
let optionsData;
|
let optionsData;
|
||||||
let avgVolume;
|
let avgVolume;
|
||||||
@ -209,10 +193,10 @@ const getRetailVolume = async (ticker) => {
|
|||||||
|
|
||||||
const postData = {'ticker': ticker};
|
const postData = {'ticker': ticker};
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/retail-volume', {
|
const response = await fetch(data?.apiURL + '/retail-volume', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,38 +1,23 @@
|
|||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
|
|
||||||
import { Chart } from 'svelte-echarts'
|
import { Chart } from 'svelte-echarts'
|
||||||
import { shareholderComponent, screenWidth, stockTicker, userRegion, getCache, setCache, displayCompanyName} from '$lib/store';
|
import { shareholderComponent, screenWidth, stockTicker, getCache, setCache, displayCompanyName} from '$lib/store';
|
||||||
import { formatString } from '$lib/utils';
|
import { formatString } from '$lib/utils';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { abbreviateNumber } from '$lib/utils';
|
import { abbreviateNumber } from '$lib/utils';
|
||||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||||
import Lazy from 'svelte-lazy';
|
import Lazy from 'svelte-lazy';
|
||||||
|
|
||||||
|
export let data;
|
||||||
let isLoaded = false;
|
let isLoaded = false;
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
|
|
||||||
let callPercentage;
|
let callPercentage;
|
||||||
let putPercentage;
|
let putPercentage;
|
||||||
let totalCalls;
|
let totalCalls;
|
||||||
let totalPuts;
|
let totalPuts;
|
||||||
let latestPutCallRatio;
|
|
||||||
let putCallRatio;
|
let putCallRatio;
|
||||||
|
|
||||||
export let data;
|
|
||||||
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let rawData = {};
|
let rawData = {};
|
||||||
let shareholderList = []
|
let shareholderList = []
|
||||||
@ -44,7 +29,6 @@ let showFullStats = false;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const plotPieChart = () => {
|
const plotPieChart = () => {
|
||||||
|
|
||||||
shareholderList = shareholderList?.filter(item => item?.ownership <= 100);
|
shareholderList = shareholderList?.filter(item => item?.ownership <= 100);
|
||||||
@ -102,10 +86,10 @@ const getShareholders = async (ticker) => {
|
|||||||
|
|
||||||
const postData = {'ticker': ticker};
|
const postData = {'ticker': ticker};
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/shareholders', {
|
const response = await fetch(data?.apiURL + '/shareholders', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,21 +1,6 @@
|
|||||||
import { userRegion, getCache, setCache } from '$lib/store';
|
import {getCache, setCache } from '$lib/store';
|
||||||
|
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
export const load = async ({parent}) => {
|
export const load = async ({parent}) => {
|
||||||
|
|
||||||
@ -28,10 +13,10 @@ export const load = async ({parent}) => {
|
|||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/cramer-tracker', {
|
const response = await fetch(data?.apiURL + '/cramer-tracker', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,6 @@ const checkMarketHour = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL;
|
let apiURL;
|
||||||
let wsURL;
|
let wsURL;
|
||||||
|
|||||||
@ -1,24 +1,7 @@
|
|||||||
import { userRegion, getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from '$lib/store';
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL = import.meta.env.VITE_EU_API_URL; // Set a default API URL
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
export const load = async ({ parent, params }) => {
|
||||||
|
|
||||||
|
|
||||||
export const load = async ({ params }) => {
|
|
||||||
|
|
||||||
const getAnalystTickerHistory = async () => {
|
const getAnalystTickerHistory = async () => {
|
||||||
|
|
||||||
@ -28,15 +11,17 @@ export const load = async ({ params }) => {
|
|||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
const data = await parent();
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID
|
||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/analyst-ticker-history', {
|
const response = await fetch(data?.apiURL + '/analyst-ticker-history', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,22 +1,7 @@
|
|||||||
import { userRegion, getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from '$lib/store';
|
||||||
|
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
export const load = async ({ parent, params }) => {
|
||||||
|
|
||||||
let apiURL = import.meta.env.VITE_EU_API_URL; // Set a default API URL
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
export const load = async ({ params }) => {
|
|
||||||
const getStockDividend = async () => {
|
const getStockDividend = async () => {
|
||||||
let newsList;
|
let newsList;
|
||||||
|
|
||||||
@ -25,15 +10,18 @@ export const load = async ({ params }) => {
|
|||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
newsList = cachedData;
|
newsList = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
const data = await parent();
|
||||||
|
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID
|
||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/stock-dividend', {
|
const response = await fetch(data?.apiURL + '/stock-dividend', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,19 +1,4 @@
|
|||||||
import { userRegion, getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from '$lib/store';
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL = import.meta.env.VITE_EU_API_URL; // Set a default API URL
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -39,7 +24,10 @@ const transactionTypeMap = {
|
|||||||
'': 'n/a'
|
'': 'n/a'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const load = async ({ params }) => {
|
export const load = async ({ parent, params }) => {
|
||||||
|
|
||||||
|
const data = await parent();
|
||||||
|
|
||||||
|
|
||||||
const getInsiderTrading = async () => {
|
const getInsiderTrading = async () => {
|
||||||
let output;
|
let output;
|
||||||
@ -54,10 +42,10 @@ export const load = async ({ params }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/insider-trading', {
|
const response = await fetch(data?.apiURL + '/insider-trading', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
@ -92,10 +80,10 @@ export const load = async ({ params }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/insider-trading-statistics', {
|
const response = await fetch(data?.apiURL + '/insider-trading-statistics', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
@ -122,10 +110,10 @@ async function historicalPrice() {
|
|||||||
timePeriod: 'max',
|
timePeriod: 'max',
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(apiURL+'/historical-price', {
|
const response = await fetch(data?.apiURL+'/historical-price', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,24 +1,8 @@
|
|||||||
import { userRegion, getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from '$lib/store';
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const load = async ({ parent, params }) => {
|
||||||
export const load = async ({ params }) => {
|
|
||||||
const getSenateTrading = async () => {
|
const getSenateTrading = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
@ -27,15 +11,18 @@ export const load = async ({ params }) => {
|
|||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
const data = await parent();
|
||||||
|
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID
|
||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/congress-trading-ticker', {
|
const response = await fetch(data?.apiURL + '/congress-trading-ticker', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,23 +1,8 @@
|
|||||||
import { userRegion, getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from '$lib/store';
|
||||||
|
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL = import.meta.env.VITE_EU_API_URL; // Set a default API URL
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const load = async ({ params }) => {
|
export const load = async ({ parent, params }) => {
|
||||||
const getStockNews = async () => {
|
const getStockNews = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
@ -26,15 +11,18 @@ export const load = async ({ params }) => {
|
|||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
const data = await parent();
|
||||||
|
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID
|
||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/stock-news', {
|
const response = await fetch(data?.apiURL + '/stock-news', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,19 +1,4 @@
|
|||||||
import { userRegion, getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from '$lib/store';
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
|
|
||||||
let apiURL = import.meta.env.VITE_EU_API_URL; // Set a default API URL
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function daysLeft(targetDate) {
|
function daysLeft(targetDate) {
|
||||||
@ -28,7 +13,10 @@ function daysLeft(targetDate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const load = async ({ params }) => {
|
export const load = async ({ parent, params }) => {
|
||||||
|
|
||||||
|
|
||||||
|
const data = await parent();
|
||||||
|
|
||||||
|
|
||||||
const getOptionsPlotData = async () => {
|
const getOptionsPlotData = async () => {
|
||||||
@ -38,16 +26,15 @@ export const load = async ({ params }) => {
|
|||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
res = cachedData;
|
res = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(apiURL + '/options-plot-ticker', {
|
const response = await fetch(data?.apiURL + '/options-plot-ticker', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
@ -105,10 +92,10 @@ export const load = async ({ params }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/options-flow-ticker', {
|
const response = await fetch(data?.apiURL + '/options-flow-ticker', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,19 +1,8 @@
|
|||||||
import { userRegion, getCache, setCache } from '$lib/store';
|
import {getCache, setCache } from '$lib/store';
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
let apiURL = import.meta.env.VITE_EU_API_URL; // Set a default API URL
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
export const load = async ({ params }) => {
|
|
||||||
|
export const load = async ({ parent, params }) => {
|
||||||
const getBalanceSheetStatement = async () => {
|
const getBalanceSheetStatement = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
@ -22,15 +11,17 @@ export const load = async ({ params }) => {
|
|||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
const data = await parent();
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID
|
||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/stock-balance-sheet', {
|
const response = await fetch(data?.apiURL + '/stock-balance-sheet', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,18 +1,7 @@
|
|||||||
import { userRegion, getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from '$lib/store';
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
let apiURL = import.meta.env.VITE_EU_API_URL; // Set a default API URL
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
export const load = async ({ parent, params }) => {
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const load = async ({ params }) => {
|
|
||||||
const getCashFlowStatement = async () => {
|
const getCashFlowStatement = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
@ -21,15 +10,18 @@ export const load = async ({ params }) => {
|
|||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
const data = await parent();
|
||||||
|
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID
|
||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/stock-cash-flow', {
|
const response = await fetch(data?.apiURL + '/stock-cash-flow', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,18 +1,7 @@
|
|||||||
import { userRegion, getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from '$lib/store';
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
export const load = async ({ parent, params }) => {
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const load = async ({ params }) => {
|
|
||||||
const getIncomeStatement = async () => {
|
const getIncomeStatement = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
@ -21,15 +10,17 @@ export const load = async ({ params }) => {
|
|||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
const data = await parent();
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID
|
||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/stock-income', {
|
const response = await fetch(data?.apiURL + '/stock-income', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,21 +1,7 @@
|
|||||||
import { userRegion, getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from '$lib/store';
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
|
||||||
let apiURL;
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
|
||||||
|
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
export const load = async ({ parent, params }) => {
|
||||||
if (usRegion.includes(value)) {
|
|
||||||
apiURL = import.meta.env.VITE_USEAST_API_URL;
|
|
||||||
} else {
|
|
||||||
apiURL = import.meta.env.VITE_EU_API_URL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const load = async ({ params }) => {
|
|
||||||
const getRatiosStatement = async () => {
|
const getRatiosStatement = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
@ -24,15 +10,17 @@ export const load = async ({ params }) => {
|
|||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
const data = await parent();
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID
|
||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/stock-ratios', {
|
const response = await fetch(data?.apiURL + '/stock-ratios', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json", "X-API-KEY": data?.apiKey
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData)
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user