state shape - 1a2b3c4dBobAn/Cyber-Wallet GitHub Wiki

const sampleState = {

entities: {

users: {
  1: {
    id: 1,
    userName: "Rich$Boi",
    email: "[email protected]",
  },

  2: {
    id: 2,
    userName: "Paper$Boi",
    email: "[email protected]",
  }
},


portfolios: {
  2: {
    id: 1,
    userId: 2,
    purchasePower: 1000000
  },

  2: {
    id: 2,
    userId: 1,
    purchasePower: 1000000
  }
},

watchlist: {
  1: {
    id: 1,
    stockId: 2,
    watchlistitemsId: 1
  },

  2: {
    id: 2,
    stock_id: 1,
    watchlistitemsId: 3
  },

  3: {
    id: 3,
    stockId: 1,
    watchlistitemsId: 1
  }
}

fills: {
  1191: {
    id: 1191,
    stockId: 4,
    userId: 1,
    price: 200,
    size: 20,
    side: "sell",
    timestamp: 1519211811670
  },

  1192: {
    id: 1192,
    stockId: 1,
    userId: 2,
    price: 100,
    size: 10,
    side: "buy",
    timestamp: 1519211811670
  }
},
 
prices: {
 1:{
   id: 1,
   stockSymbol: 2,
   function: TIME_SERIES_WEEKLY,
   close_prices: [9, 2, 5, 6, 6, 1, 3, 7 ]
   },

 2:{
   id: 1,
   stockSymbol: 'AAPL',
   function: 'TIME_SERIES_WEEKLY',
   close_prices: [100, 97, 95, 92, 95, 96, 94, 100, 97, 95, 92, 95, 96, 94, 92, 95, 96, 94,94,100, 97, 95 ,94, 92, 95, 96,]
   }
 },

stocks: {
  1: {
    id: 1,
    symbol: "ECORP",
    name: "E Corp",
    description: "E Corp is a multinational conglomerate.",
    ceo: "Phillip Price",
    latestPrice: 100
    }
  }
 },

 ui: {
     loading: true/false
 },

  errors: {
    login: ["Password does not match email"],
    tradeForm: ["Insufficient buying power."],
    tradeForm: ["Insufficient number of stocks."],
  },

 session: {
    id: 100
  }

};