Skip to content

Commit

Permalink
Mock trader model completed
Browse files Browse the repository at this point in the history
  • Loading branch information
DemidenGo committed Oct 17, 2023
1 parent 905db92 commit 1774a64
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
12 changes: 12 additions & 0 deletions TradingView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
92F5D9102ADF18110065CA99 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F5D90F2ADF18110065CA99 /* ViewController.swift */; };
92F5D9152ADF18120065CA99 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 92F5D9142ADF18120065CA99 /* Assets.xcassets */; };
92F5D9182ADF18120065CA99 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 92F5D9162ADF18120065CA99 /* LaunchScreen.storyboard */; };
92F5D9212ADF20890065CA99 /* TraderModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F5D9202ADF20890065CA99 /* TraderModel.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -22,6 +23,7 @@
92F5D9142ADF18120065CA99 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
92F5D9172ADF18120065CA99 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
92F5D9192ADF18120065CA99 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
92F5D9202ADF20890065CA99 /* TraderModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TraderModel.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -56,6 +58,7 @@
children = (
92F5D90B2ADF18110065CA99 /* AppDelegate.swift */,
92F5D90D2ADF18110065CA99 /* SceneDelegate.swift */,
92F5D91F2ADF204D0065CA99 /* Model */,
92F5D90F2ADF18110065CA99 /* ViewController.swift */,
92F5D9142ADF18120065CA99 /* Assets.xcassets */,
92F5D9162ADF18120065CA99 /* LaunchScreen.storyboard */,
Expand All @@ -64,6 +67,14 @@
path = TradingView;
sourceTree = "<group>";
};
92F5D91F2ADF204D0065CA99 /* Model */ = {
isa = PBXGroup;
children = (
92F5D9202ADF20890065CA99 /* TraderModel.swift */,
);
path = Model;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -137,6 +148,7 @@
92F5D9102ADF18110065CA99 /* ViewController.swift in Sources */,
92F5D90C2ADF18110065CA99 /* AppDelegate.swift in Sources */,
92F5D90E2ADF18110065CA99 /* SceneDelegate.swift in Sources */,
92F5D9212ADF20890065CA99 /* TraderModel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
65 changes: 65 additions & 0 deletions TradingView/Model/TraderModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// TraderModel.swift
// TradingView
//
// Created by Юрий Демиденко on 17.10.2023.
//

import Foundation

enum Country {
case usa, can, bra, jap, ger, fra, aus, ind, spa
}

struct TraderModel {

let name: String
let country: Country
let deposit: Int
let profit: Int

static func makeMockModel() -> [TraderModel] {
var model = [TraderModel]()
model.append(TraderModel(name: "Oliver",
country: .usa,
deposit: 8367,
profit: 336755))
model.append(TraderModel(name: "Jack",
country: .can,
deposit: 7489,
profit: 287190))
model.append(TraderModel(name: "Harry",
country: .bra,
deposit: 7004,
profit: 230712))
model.append(TraderModel(name: "Jacob",
country: .jap,
deposit: 6489,
profit: 198640))
model.append(TraderModel(name: "Charley",
country: .ger,
deposit: 6084,
profit: 167500))
model.append(TraderModel(name: "Thomas",
country: .bra,
deposit: 5602,
profit: 139750))
model.append(TraderModel(name: "George",
country: .fra,
deposit: 4992,
profit: 97600))
model.append(TraderModel(name: "Oscar",
country: .aus,
deposit: 4299,
profit: 75100))
model.append(TraderModel(name: "James",
country: .ind,
deposit: 3015,
profit: 53760))
model.append(TraderModel(name: "William",
country: .spa,
deposit: 1563,
profit: 25905))
return model
}
}

0 comments on commit 1774a64

Please sign in to comment.