forked from coltoneshaw/3cpm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial reserve funds and redoing the settings page
** This branch does not compile in webpack
- Loading branch information
1 parent
9880ba5
commit 9f3de74
Showing
22 changed files
with
657 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Accound Endpoints | ||
|
||
## Balance Chart Data | ||
Endpoint - `GET /public/api/ver1/accounts/{account_id}/balance_chart_data` | ||
Notes: | ||
|
||
Response: | ||
```json | ||
[ | ||
{ | ||
date: 1619308800, // Epoch date in seconds | ||
usd: 147.76, | ||
btc: 0.002991, | ||
btc_deposit_amount: 0, // The deposit metrics only get updated when you deposit through 3commas | ||
usd_deposit_amount: 0 // | ||
}, | ||
... | ||
{ | ||
date: 1627862400, | ||
usd: 15634.38, | ||
btc: 0.401757, | ||
btc_deposit_amount: 0, | ||
usd_deposit_amount: 0 | ||
} | ||
] | ||
``` | ||
|
||
|
||
|
||
Response: | ||
|
||
```json | ||
[ | ||
{ | ||
id: 30035777, | ||
auto_balance_period: 12, | ||
auto_balance_portfolio_id: null, | ||
auto_balance_currency_change_limit: null, | ||
autobalance_enabled: false, | ||
is_locked: false, | ||
smart_trading_supported: true, | ||
smart_selling_supported: true, | ||
available_for_trading: {}, | ||
stats_supported: true, | ||
trading_supported: true, | ||
market_buy_supported: true, | ||
market_sell_supported: true, | ||
conditional_buy_supported: true, | ||
bots_allowed: true, | ||
bots_ttp_allowed: true, | ||
bots_tsl_allowed: false, | ||
gordon_bots_available: true, | ||
multi_bots_allowed: true, | ||
created_at: '2021-04-25T10:44:25.648Z', | ||
updated_at: '2021-06-22T04:46:28.128Z', | ||
last_auto_balance: null, | ||
fast_convert_available: true, | ||
grid_bots_allowed: true, | ||
api_key_invalid: false, | ||
nomics_id: 'binance_us', | ||
market_icon: 'https://3commas.io/img/exchanges/binance.png', | ||
supported_market_types: [ 'spot' ], | ||
api_key: 'OVnLHUyXmMiiXT2fQXDkWyYqlOnkC3er3rd3xAC7AKLCWP5Fnom0kYG9ewtNCCoO', | ||
name: 'Binance US', | ||
auto_balance_method: 'time', | ||
auto_balance_error: null, | ||
lock_reason: null, | ||
btc_amount: '0.40997708013273871104906805092618080738584', // total funds converted to BTC as of the current day's close. | ||
usd_amount: '15583.4994007182860145243690006177437680686530544', // total funds available in USD | ||
day_profit_btc: '0.001122175123597340587318102804499239978062', | ||
day_profit_usd: '-24.8593853526494418137533084188808801097469456', // portfolio balance 30 days ago compared with today divided by 30. | ||
day_profit_btc_percentage: '0.02', | ||
day_profit_usd_percentage: '-0.14', | ||
btc_profit: '-0.01083926501132428895093194907381919261416', // trailing 30 day profit | ||
usd_profit: '629.9757352158860145243690006177437680686530544', // trailing 30 day profit | ||
usd_profit_percentage: '4.21', | ||
btc_profit_percentage: '-2.58', | ||
total_btc_profit: '0.4069863069789086', | ||
total_usd_profit: '15435.739595083216', // this appears to count every dollar deposited as profit. | ||
pretty_display_type: 'BinanceUs', | ||
exchange_name: 'Binance US', | ||
market_code: 'binance_us' | ||
} | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
src/app/Components/Pages/Settings/Components/AccountDropdown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
// import React, { useState, useEffect } from 'react'; | ||
|
||
// import { | ||
// FormControl, | ||
// InputLabel, | ||
// MenuItem, | ||
// Select | ||
// } from '@material-ui/core'; | ||
|
||
// import Checkbox from '@material-ui/core/Checkbox'; | ||
// import ListItemText from '@material-ui/core/ListItemText'; | ||
// import Input from '@material-ui/core/Input'; | ||
|
||
// import { accountDataAll } from '@/utils/3Commas'; | ||
// import { useGlobalState } from '@/app/Context/Config'; | ||
// import { defaultConfig, findConfigData } from '@/utils/defaultConfig'; | ||
// import { Type_Query_Accounts } from '@/types/3Commas' | ||
|
||
|
||
// const accountIdPath = 'statSettings.account_id' | ||
|
||
// // initializing a state for each of the two props that we are using. | ||
// const ITEM_HEIGHT = 48; | ||
// const ITEM_PADDING_TOP = 8; | ||
// const MenuProps = { | ||
// PaperProps: { | ||
// style: { | ||
// maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP, | ||
// width: 250, | ||
// }, | ||
// }, | ||
// }; | ||
|
||
// const noAccount = [{ | ||
// currency_code: "USD", | ||
// id: 0, | ||
// account_id: 0, | ||
// account_name: "no account", | ||
// exchange_name: "blank", | ||
// percentage: 0, | ||
// position: 0, | ||
// on_orders: 0, | ||
// btc_value: 0, | ||
// usd_value: 0, | ||
// market_code: 0 | ||
// }] | ||
|
||
|
||
|
||
// const AccountDropdown = ( ) => { | ||
// const state = useGlobalState() | ||
// const { config, state: { accountID, updateAccountID } } = state; | ||
|
||
|
||
// /** | ||
// * TODO | ||
// * - Move this into the config element and pass it down, or pull from the data element. | ||
// */ | ||
// const [accountData, changeAccountData] = useState<Type_Query_Accounts[]>( () => noAccount ) | ||
// const [select, selectElement] = useState<any[] | undefined>([]) | ||
|
||
// // @ts-ignore | ||
// useEffect(() => { | ||
// let mounted = true | ||
// accountDataAll() | ||
// .then((data: Type_Query_Accounts[]) => { | ||
// if (mounted) { | ||
// // removing duplicate accounts | ||
// const filteredAccounts = Array.from(new Set(data.map(a => a.account_id))).map(id => data.find(a => a.account_id === id)) | ||
|
||
// // @ts-ignore | ||
// changeAccountData(filteredAccounts) | ||
|
||
// } | ||
// }) | ||
// return () => mounted = false | ||
// }, []) | ||
|
||
// useEffect(() => { | ||
// // @ts-ignore | ||
// let findAccounts: array[] = findConfigData(config, accountIdPath); | ||
// findAccounts = (findAccounts) ? findAccounts : [] | ||
// selectElement(findAccounts) | ||
// }, [config]) | ||
|
||
// const returnAccountNames = (accountData: Type_Query_Accounts[], accountIdArray: number[]) => { | ||
// return accountData.filter(e => accountIdArray.includes(e.account_id)).map(e => e.account_name).join(', ') | ||
// } | ||
|
||
// // const [select, selectElement] = useState(() => accountID) | ||
|
||
|
||
// // changing the select value | ||
// const handleChange = (event:any ) => { | ||
// updateAccountID(event.target.value) | ||
// selectElement(event.target.value) | ||
// console.log(event.target.value) | ||
// }; | ||
|
||
|
||
// return ( | ||
// <FormControl style={{width: "100%"}}> | ||
// <InputLabel>Account Filter</InputLabel> | ||
|
||
|
||
// <Select | ||
// multiple | ||
// value={select} | ||
// onChange={handleChange} | ||
// input={<Input />} | ||
// // @ts-ignore | ||
// renderValue={() => (accountData.length > 0) ? returnAccountNames(accountData, select) : ""} | ||
// MenuProps={MenuProps} | ||
// > | ||
// {/* Need to think through All because it's now a selector. */} | ||
// {/* <MenuItem value=""></MenuItem> */} | ||
|
||
// {/* @ts-ignore */} | ||
// {accountData.map((account) => ( | ||
// <MenuItem key={account.account_id} value={account.account_id}> | ||
|
||
// {/* @ts-ignore */} | ||
|
||
// <Checkbox checked={select.indexOf(account.account_id) > -1} /> | ||
// <ListItemText primary={account.account_name} /> | ||
// </MenuItem> | ||
// ))} | ||
// </Select> | ||
// </FormControl> | ||
// ) | ||
|
||
|
||
|
||
// } | ||
|
||
// export default AccountDropdown |
Oops, something went wrong.